// Enter the date to get the day of the week
Public String getweekday (string datestr ){
Simpledateformat formatymd = new simpledateformat ("yyyy-mm-dd"); // formatymd indicates the yyyy-mm-dd format.
Simpledateformat formatd = new simpledateformat ("e"); // "E" indicates "Day in week"
Date d = NULL;
String weekday = "";
Try {
D = formatymd. parse (datestr); // convert string to a date in the correct format
Weekday = formatd. Format (d );
} Catch (exception e ){
E. printstacktrace ();
}
// System. Out. println ("Date:" + datestr + ":" + weekday );
Return weekday;
}
// Calculate the date in the middle of two time periods
Public String [] [] finddates (string start_time, string end_time) throws parseexception {
Simpledateformat df = new simpledateformat ("yyyy-mm-dd ");
Date date1 = DF. parse (start_time );
Date date2 = DF. parse (end_time );
Int S = (INT) (date2.gettime ()-date1.gettime ()/(24*60*60*1000 ));
String value [] [] = new string [S + 1] [1];
If (S + 1> 0 ){
For (INT I = 0; I <= s; I ++ ){
Long todaydate = date1.gettime () + I * 24*60*60*1000;
Date tmdate = new date (todaydate );
Value [I] [0] = new simpledateformat ("yyyy-mm-dd"). Format (tmdate );
// System. Out. println (New simpledateformat ("yyyy-mm-dd"). Format (tmdate ));
}
}
Return value;
}