The difference between the time stamp Date.parse () and dateObject.getTime () of

一、 Date.parse()

parse () method can parse a date time string, and returns the number of milliseconds 1970/1/1 midnight of the date from the time.

Resolution:

1, parse () method of the Date object as a static method, commonly used Date.parse () call to the form, instead of calling the method by dateobject.parse ().

2, parse () returns the number of milliseconds from 1970/01/01 to a specific date

3, Date.parse ( 'time can be customized character string, the type of time').

DATE Date.parse = var ( '2018/07/11') 
var Date.parse Time = ( '2019-08-09T18: 23 is: 27.000 + 0800') 
the console.log ( 'DATE', DATE) 
the console.log ( 'Time', Time) 
// Note ios recognize only '/' format

二、dateObject.getTime()

This method returns the number of milliseconds from between January 1, 1970;

Resolution:

1, getTime (): 1970/01/01 to output from a current (new Date ()) of the number of milliseconds;

2, the method is always used in conjunction with a Date object;. New Date () getTime () 

var time = new Date();
console.log(time.getTime());

  

 

Guess you like

Origin www.cnblogs.com/qiu-Ann/p/11359668.html