Java/Android Calendar, add 1 week on Sundays -
ok, code has worked until day became sunday.
i'm working on app uses calendar util allot, functioning way think important me! problem:
import java.util.calendar; ... calendar test = calendar.getinstance(); test.setfirstdayofweek(calendar.monday); log.e("weeek test:", ""+ test.get(calendar.week_of_year)); test.add(calendar.week_of_year, 1); log.e("weeek test:", ""+ test.get(calendar.week_of_year));
outputs this:
06-01 14:04:07.636 12005-12005/test.app e/weeek test:﹕ 23 06-01 14:04:07.636 12005-12005/test.app e/weeek test:﹕ 23
how can happen, , how fix it?
calendar test = calendar.getinstance(); test.add(calendar.week_of_year, -1); test.add(calendar.week_of_year, 1); test.setfirstdayofweek(calendar.monday);
now "test" should work correctly
Comments
Post a Comment