As for my understanding, it is simple and clear:
Timestamp: A date is represented by a number, which is the number of seconds of this date.
Date: It is our common form of time expression.
Time stamping for the general look at the time is not straightforward, but in the program of the world can be a big role.
Gets the current timestamp:
1 // Gets the current timestamp (in s) 2 var timestamp = date.parse (new Date ()); 3 timestamp = timestamp/1000;
To get a timestamp for a date:
1 // gets the timestamp of a time format 2 var stringtime = "2017-11-05 10:21:12"; 3 var timestamp2 = Date.parse (new Date (stringtime)); 4 timestamp2 = timestamp2/1000;
Convert a timestamp to a date:
1 //change the current time to a time format string2 varTimestamp3 = 1403058804;3 varNewdate =NewDate ();4Newdate.settime (Timestamp3 * 1000);5 //Wed June6 Console.log (newdate.todatestring ());7 //Wed, June 02:33:24 GMT8 Console.log (newdate.togmtstring ());9 //2014-06-18t02:33:24.000zTen Console.log (newdate.toisostring ()); One //2014-06-18t02:33:24.000z A Console.log (Newdate.tojson ()); - //June 18, 2014 - Console.log (newdate.tolocaledatestring ()); the //June 18, 2014 morning 10:33:24 - Console.log (newdate.tolocalestring ()); - //Morning 10:33:24 - Console.log (newdate.tolocaletimestring ()); + //Wed June 10:33:24 gmt+0800 (China Standard Time) - Console.log (newdate.tostring ()); + //10:33:24 gmt+0800 (China Standard Time) A Console.log (newdate.totimestring ()); at //Wed, June 02:33:24 GMT -Console.log (Newdate.toutcstring ());
Js_ the conversion between the timestamp and the time format.