這可能是由於語言環境。在Java
Calendar calFr = Calendar.getInstance(TimeZone.getTimeZone("Europe/Paris"), Locale.FRANCE);
Calendar calUs = Calendar.getInstance(TimeZone.getTimeZone("US/Eastern"), Locale.US);
Calendar calUk = Calendar.getInstance(TimeZone.getTimeZone("GMT"), Locale.UK);
calFr.set(2013, Calendar.JANUARY, 27);
calUs.set(2013, Calendar.JANUARY, 27);
calUk.set(2013, Calendar.JANUARY, 27);
int weekOfMonthFr = calFr.get(Calendar.WEEK_OF_MONTH);
int weekOfMonthUs = calUs.get(Calendar.WEEK_OF_MONTH);
int weekOfMonthUk = calUk.get(Calendar.WEEK_OF_MONTH);
System.out.println("France week of month is " + weekOfMonthFr);
System.out.println("USA week of month is " + weekOfMonthUs);
System.out.println("UK week of month is " + weekOfMonthUk);
會給你
France week of month is 4
USA week of month is 5
UK week of month is 4
哪裏是哪裏,你已經設置系統日期的代碼?這是這裏最重要的一段代碼。更重要的是,你是運行完全相同的代碼還是有差異的空間? – HXCaine
我相信日曆是區域設置和時區相關的。你的兩臺設備是否註冊到不同的時區或地區?如果時間以毫秒爲單位設置,那麼有可能時區使它成爲不同的日子。如果有疑問,請使用JodaTime http://joda-time.sourceforge.net/ – BoredAndroidDeveloper
一臺設備可能還有星期一作爲本週的開始,因爲第27天是星期天。 – Eric