java - Show 12 days before Date as Current date -


i have made custom calendar.it shows device's date current date.but requirement show 12 days before date current date. e.g-today 21 want calendar show 9.i want same year also. know how current date .i using code.

_calendar = calendar.getinstance(locale.getdefault());                 month = _calendar.get(calendar.month) + 1;                 year = _calendar.get(calendar.year);                 log.d(tag, "calendar instance:= " + "month: " + month + " " + "year: " + year); 

every appropriated.

my new code is

_calendar = calendar.getinstance(locale.getdefault());                 month = _calendar.get(calendar.month) + 1;                 year = _calendar.get(calendar.year);                 log.d(tag, "calendar instance:= " + "month: " + month + " " + "year: " + year);                 /*_calendar.add(calendar.day_of_year, -12);*/                 _calendar.roll(calendar.day_of_month, -12);                 _calendar.roll(calendar.month, -12);                 calendar _calendar=calendar.getinstance(); 

try:

_calendar.roll(calendar.day_of_year, -12); _calendar.roll(calendar.year, -12); 

this roll days 12, , year 12.


Comments