Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

1 Answer
Samual Sam

You can use getTime() for this. Following is the syntax −

yourVariableName.getTime();

Convert ISODate to numerical value −

> var arrivalDate=ISODate('2019-04-18 13:50:45');

Following is the query to convert ISODate to numerical value −

> arrivalDate.getTime();

This will produce the following output −

1555595445000

Let us verify that it is a correct numerical value for ISODate or not. Following is the query to get correct ISODate whenever we apply above numeric value −

> new Date(1555595445000);

This will produce the following output −

ISODate("2019-04-18T13:50:45Z")

Yes, this is a correct ISODate.

Advertisements

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.