1) Date converted to milliseconds
If the format is: Yyyy/mm/dd Hh:mm:ss can be converted directly. var oldtime = (New Date ("2018/07/09 14:13:11")). GetTime (); Get the number of milliseconds
If the date format is: YYYY-MM-DD HH:MM:SS need conversion format
var startdate = ' 2018-07-09 14:13:11 ';
Startdate= Startdate.replace (New RegExp ("-", "GM"), "/");
var Startdatem = (new Date (StartDate)). GetTime (); Get the number of milliseconds
Another way to convert a date to milliseconds:
var str = ' 2018-07-09 14:13:11 ';
var arr = str.split (/[-: \/]/);
var startdate = date.parse (new Date (Arr[0], arr[1]-1, arr[2], arr[3], arr[4], arr[5]));
Console.log (StartDate)
2) Number of milliseconds converted to time
var endDate = (New Date ("2018/072/09 14:13:11")). GetTime (); Get the number of milliseconds
var newdate = new Date (endDate); It's time to get a regular.
JS time and milliseconds convert each other