System.currenttimemillis () produces a current millisecond, which is actually the number of milliseconds since 0 o'clock January 1, 1970, and date () is actually the equivalent of date (System.currenttimemillis ()), Because the date class also has a construct date (longdate), it is used to calculate the millisecond difference between long seconds and January 1, 1970.
Given this millisecond, we can count the current year and the week, but that's not what we're going to calculate, because the final result of the Calendar.calendar is the date and time zone.
System.currenttimemillis () Gets the time distance from 1970-01-01 00:00:00.000 to the current moment, type long
String.valueof (System.currenttimemillis ()) This statement can be converted to a format:
Long ct = System.currenttimemillis ();
String t = string.valueof (CT);
In fact, the above string T is equivalent to ct+ "";
Knowledge to string format
Public String refformatnowdate () {
Date Nowtime = new Date (System.currenttimemillis ());
SimpleDateFormat sdformatter = new SimpleDateFormat ("Yyy-mm-dd");
String retstrformatnowdate = Sdformatter.format (nowtime);
return retstrformatnowdate;
}
Java get current system event System.currenttimemillis ()