Converts a Date object to a timestamp
The first method, using the number () method
var newday = new Date ();
Console.log (number (newday));
Returns the time stamp of the current time
The second approach is to use the Date Object Date.parse () method
var newday = new Date ();
Console.log (Date.parse (NewDay));
Also returns the timestamp of the current time
The third method is to escape with an escape character
var newday = +new Date ();
Console.log (NewDay);
Comparing the two methods,
The first time stamp returned using the method of a numeric object is accurate to milliseconds, and the Date object's Date.parse () method is only accurate to the second, and the three digits are filled with 0, so the individual recommends the first
convert timestamp to date object
var newdate = new Date (timestamp); Instantiate a Date object, pass the timestamp directly into it, and note that it must be 13-bit
Or
var Timestamp3 = 1403058804000; Declare a timestamp
var newdate = new Date (); Instantiates a Date object
newdate.settime (Timestamp3);//Set time for the date object to be timestamp