1
我有以下代碼:這個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
顯然,二零一三年八月七日在不一個星期六。
請問我在做什麼錯?
謝謝!
非常感謝你! –