2 momo1199 Momo1199 于 2013.07.01 17:08 提问

GregorianCalendar出了什么错?

代码:

Log.e("year = ",eventiCompleti.get(i).year);
Log.e("month = ",eventiCompleti.get(i).month);
Log.e("day = ",eventiCompleti.get(i).day);
Log.e("hour = ",eventiCompleti.get(i).hour);

TimeZone MyTimezone = TimeZone.getDefault();
Calendar calendar = new GregorianCalendar(MyTimezone);                              
calendar.set(Integer.parseInt(eventiCompleti.get(i).year),Integer.parseInt( eventiCompleti.get(i).month),Integer.parseInt( eventiCompleti.get(i).day),0,0,0);
String month_name=calendar.getDisplayName(Calendar.MONTH, Calendar.LONG, Locale.getDefault());//Locale.US);
String day_name=calendar.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.LONG, Locale.getDefault());

Log.e("day of the week = ",day_name);

输出:

06-30 21:33:55.828: E/year =(11254): 2013
06-30 21:33:55.828: E/month =(11254): 08
06-30 21:33:55.828: E/day =(11254): 07
06-30 21:33:55.828: E/hour =(11254): 18:00
06-30 21:33:55.828: E/day of the week =(11254): Saturday

但是2013年8月7号并不是星期六。

不知道哪出错了?

谢谢。

Csdn user default icon
上传中...
上传图片
插入图片