Android Emulator Returns Wrong Date
I am trying to get the date in Android using this code
final Date df = new Date();
开发者_StackOverflow中文版 final DateFormat dft;
dft = DateFormat.getDateInstance(DateFormat.SHORT, Locale.US);
final String dftX = dft.format(df).toString();
This works but it returns as 11/03/10 instead of 12/03/10. The emulator appears to be showing the correct date. What am I doing wrong?
Rick
As far as I know, you must add a "+1" to your month because in Date conversion the counting month begins with "0" as Jan and ends with "11" for Dec
精彩评论