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 has a constructed date (long date), it is used to calculate the millisecond difference between long and January 1, 1970.
Given this millisecond, we can count the current day and the week, but this is not what we calculate, because there is a calendar. The final result of the calendar is the day of the month and the week zone.
System.currenttimemillis () Gets the time distance from 1970-1-01 00:00:00.000 to the current moment, type long
String.valueof (System.currenttimemillis ()) This statement can be converted to the following pattern:
Long ct = System.currenttimemillis ();
String t = string.valueof (CT);
In fact, the above string T is equivalent to ct+ "";
Just convert to string format
Public String refformatnowdate () {
Date Nowtime = new Date (System.currenttimemillis ());
SimpleDateFormat sdformatter = new SimpleDateFormat ("Yyyy-mm-dd");
String retstrformatnowdate = Sdformatter.format (nowtime);
return retstrformatnowdate;
}
Http://blog.sina.com.cn/s/blog_7309444701016yv5.html
Java gets current system time System.currenttimemillis ()