Converts milliseconds to days and seconds
public static void Main (string[] args) {
Date date = new Date ();
System.out.println (Date.gettime ());
Long a = Date.gettime ();
Date date1 = new Date (a);
SimpleDateFormat SDF = new SimpleDateFormat ("Yyyy-mm-dd hh:mm:ss");
String strdate = Sdf.format (date1);
System.out.println (strdate);
}
Compare two times the size of a string into a time date type
public static void Main (string[] args) throws ParseException {
Date date = new Date ();
String strdate = "2016-03-02 22:12:11";
SimpleDateFormat format = new SimpleDateFormat ("Yyyy-mm-dd HH:mm:ss");
Date date1 = Format.parse (strdate);
if (Date.gettime () > Date1.gettime ())
System.out.println ("Now Time is big");
Else
System.out.println ("String time is large");
}
The current time plus one day, calculate the time to add subtraction
public static void Main (string[] args) throws ParseException {
SimpleDateFormat SF = new SimpleDateFormat ("Yyyy-mm-dd");
Calendar C = calendar.getinstance ();
System.out.println ("Current Time:" +sf.format (C.gettime ()));
C.add (Calendar.day_of_month, 1);
System.out.println ("Add Day after Date:" +sf.format (C.gettime ()));
}
SQL for determining the time-date size in MyBatis
<! [Cdata[and Date_format (sud.endtime, '%y-%m-%d ') >= Date_format (now (), '%y-%m-%d ')]]>
Java Background Time Calculation