我正在使用以下來獲取每週的 。從0獲取周的範圍
SimpleDateFormat dateFormatforYearWeek = new SimpleDateFormat("yyyyww");
String s = dateFormatforYearWeek.format(date)
對於10月26日這給了我價值201444.但是我希望它得到儘可能201443. 我不知道如何設置的星期爲0 這可能嗎?如果不是,我該如何修改它。
這是正確的方法嗎?
int day = calendar.get(Calendar.DAY_OF_MONTH);
int year = calendar.get(Calendar.YEAR);
calendar.add(Calendar.WEEK_OF_YEAR, -1);
calendar.set(Calendar.DAY_OF_MONTH, day);
calendar.set(Calendar.YEAR, year);
SimpleDateFormat dateFormatforYearWeek = new SimpleDateFormat("yyyyww");
String s = dateFormatforYearWeek.format(date)
什麼是你_really_想幹什麼?獲取與[ISO週數](http://www.calendar-365.com/week-number.html)不同的美國週數...? – 2014-11-03 05:39:15
其實在我的數據庫中,一週從0開始。所以我想讓它保持一致。 – Yogi 2014-11-03 05:44:24
看到這個相似的問題,[在java中是否有YYYYWW格式](http://stackoverflow.com/q/24527611/642706) – 2014-11-03 07:27:02