我實際上正在通過實用類壓延機。 我發現自己混同,在Java中的第一週的最小日子
方法
getFirstDayOfWeek()
returns the first day of the week;
e.g., SUNDAY in the U.S., MONDAY in France.
和
getMinimalDaysInFirstWeek()
returns the minimal days required in the first week of the year. e.g.,
if the first week is defined as one that contains the first day of the
first month of a year, this method returns 1. If the minimal days required
must be a full week, this method returns 7.
我住在印度(UTC + 05:30)金奈,加爾各答,孟買,新德里。 在此時區內未觀察到夏令時。
爲了拿到年終的一週,我編寫這樣
Calendar calendar = Calendar.getInstance();
System.out.println(calendar.get(Calendar.WEEK_OF_YEAR)); // returns 45
45只可能是Java的對待
WeekNumber FromDate ToDate
Week 01 December 30, 2013 January 5, 2014 // December 30 is Monday
Week 45 November 3, 2014(Monday) November 9, 2014
確實Java的花費最少的天數整整一個星期要爲7 ?因爲我可以通過setMinimalDaysInFirstWeek()來更改它。它會有什麼影響?
你試過了嗎? – arcy 2014-11-03 15:11:09