Import java.text.dateFormat; import java.text.SIMPLIC STRINGMMAT; arraylist postlist) {int n = postlist.size (); string [] arraydate = new string [n]; for (int i = 0; i
public boolean CheckDatetime (String StartDatetime, String EndDateTime) {// compare two date size try {String format_str = "yyyy-MM-dd hh: mm: ss"; Date dateStr = FormatTODay (StartDatetime, format_str); Date dateEnd = FormatToday (enddatetime, format_str); if (dateend) {return true;} else {return false;}} catch (exception ex) {ex.printstacktrace (system.err); returnaf false;}}}
public Date FormatTODay (String str, String Format_str) {// apply formatting try {SimpleDateFormat formatter = new SimpleDateFormat (Format_str); Date d = formatter.parse (str); return d; / * return formatter.format (d); * /} CatCH (Exception EX) {EX.PrintStackTrace (System.err); Return Null;}}
public String FormatTOString (String str, String Format_str) {// turn into character output channeling try {SimpleDateFormat formatter = new SimpleDateFormat (Format_str); Date d = formatter.parse (str); return formatter.format (d);} catch ( Exception ex) {EX.PrintStackTrace (System.err); Return Str;}}