First, get this week
Weekfirst_date=new date ();
Weeklast_date=new date ();
Weekfirst_calendar=calendar.getinstance ();
Weeklast_calendar=calendar.getinstance ();
Weekfirst_time=null;
Weeklast_time=null;
Weekfirst_calendar.setfirstdayofweek (Calendar.monday);
Weekfirst_calendar.add (calendar.week_of_month,0);
Weekfirst_calendar.set (Calendar.day_of_week,calendar.monday);
Weekfirst_date=weekfirst_calendar.gettime ();
Weekfirst_time=formatter_1.format (weekfirst_date);
StringBuffer weekfirst_str=new StringBuffer (). Append (Weekfirst_time). Append ("00:00:00");
Weekfirst_time=weekfirst_str.tostring ();
Prev_time.settext (Weekfirst_time);
Weeklast_calendar.set (Weekfirst_calendar. Day_of_month,weekfirst_calendar.get (Weekfirst_calendar. Day_of_month) +7);
Weeklast_date=weeklast_calendar.gettime ();
Weeklast_time=formatter_1.format (weeklast_date);
StringBuffer weeklast_str=new StringBuffer (). Append (Weeklast_time). Append ("00:00:00");
Weeklast_time=weeklast_str.tostring ();
Next_time.settext (Weeklast_time);
B. Change in weeks
1. Push forward for a week
Week_cal_1.set (Calendar.day_of_month,week_cal_1.get (Calendar.day_of_month)-7);
Week_date_1=week_cal_1.gettime ();
Week_time_1=formatter_1.format (week_date_1);
StringBuffer str_weekfirst=new StringBuffer (). Append (Week_time_1). Append ("00:00:00");
Week_time_1=str_weekfirst.tostring ();
Text1.settext (week_time_1);
Week_cal_2.set (Calendar.day_of_month,week_cal_2.get (Calendar.day_of_month)-7);
Week_date_2=week_cal_2.gettime ();
Week_time_2=formatter_1.format (week_date_2);
StringBuffer str_weeklast=new StringBuffer (). Append (week_time_2). Append ("00:00:00");
Week_time_2=str_weeklast.tostring ();
Text2.settext (week_time_2);
2. Push backwards for a week
Week_cal_1.set (Calendar.day_of_month,week_cal_1.get (calendar.day_of_month) +7);
Week_date_1=week_cal_1.gettime ();
Week_time_1=formatter_1.format (week_date_1);
StringBuffer str_weekfirst=new StringBuffer (). Append (Week_time_1). Append ("00:00:00");
Week_time_1=str_weekfirst.tostring ();
Text1.settext (week_time_1);
Week_cal_2.set (Calendar.day_of_month,week_cal_2.get (calendar.day_of_month) +7);
Week_date_2=week_cal_2.gettime ();
Week_time_2=formatter_1.format (week_date_2);
StringBuffer str_weeklast=new StringBuffer (). Append (week_time_2). Append ("00:00:00");
Week_time_2=str_weeklast.tostring ();
Text2.settext (week_time_2);
java--with Shusaku as time change