Tag: Zha oid Specifies tar precision LDA www. RAC Trace
Timestamp accuracy has two concepts: 1 is accurate to seconds, and 2 is accurate to milliseconds.
To manipulate timestamps and timestamps to convert to time, the object is date, and the date conversion is inseparable from SimpleDateFormat;
If it is to obtain the time specified by the month and day, the general corresponding is localdate, and localdate all kinds of conversion is inseparable from dateformatter;
PackageCom.jsoft.testjavabasics.test1;Importjava.text.ParseException;ImportJava.text.SimpleDateFormat;ImportJava.util.Calendar;Importjava.util.Date;/*** Hello world! *@authorJim * @date 2017/11/25*/ Public classApp { Public Static voidMain (string[] args) {//accurate to milliseconds//gets the current time stampSystem.out.println (System.currenttimemillis ()); System.out.println (Calendar.getinstance (). Gettimeinmillis ()); System.out.println (NewDate (). GetTime ()); //accurate to seconds//gets the current time stampSystem.out.println (System.currenttimemillis ()/1000); System.out.println (Calendar.getinstance (). Gettimeinmillis ()/1000); System.out.println (NewDate (). GetTime ()/1000); //accurate to milliseconds//gets the time of the specified formatSimpleDateFormat DF =NewSimpleDateFormat ("Yyyy-mm-dd HH:mm:ss:SSS"); //Output StringSystem.out.println (Df.format (NewDate ())); //gets the specified time Date object, which is a timestamp and is only accurate to secondsSystem.out.println (NewDate (1510369871)); Df.getcalendar (); //gets the timestamp for the specified time Try{System.out.println (NewSimpleDateFormat ("Yyyy/mm/dd HH:mm:ss:SSS"). Parse ("2017/11/11 11:11:11:111"). GetTime ()); } Catch(ParseException e) {e.printstacktrace (); } }}
Example Project: Https://github.com/easonjim/5_java_example/tree/master/javabasicstest/test29/test1
Reference:
Http://tool.chinaz.com/Tools/unixtime.aspx (time stamp test tool)
Https://www.cnblogs.com/chen-lhx/p/5915113.html
http://blog.csdn.net/zhangzehai2234/article/details/53365633
Https://www.cnblogs.com/zhujiabin/p/6168671.html?utm_source=itdadao&utm_medium=referral
http://blog.csdn.net/wanglj7525/article/details/43408749
Java gets the current timestamp/timestamp conversion