

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the use of parsing dates in JavaScript?
Parsing a date will give us the time in milliseconds. Date.parse() is used to parse a date. This method actually returns a number of milliseconds between the provided date and January 1, 1970. It is programmed in that way by the developers to get time in milliseconds from January 1, 1970 to the date provided.
Example-1
In the following example, using Date.parse() a number of milliseconds were calculated between July 14, 2019 and January 1, 1970.
<html> <body> <p>Date.parse() returns the number of milliseconds between july 14, 2019 and January 1, 1970 </p> <script> var time = Date.parse("july 14, 2019"); document.write(time); </script> </body> </html>
Output
1563042600000
Example-2
In the following example, using Date.parse() a number of milliseconds were calculated between June 14, 1999 and January 1, 1970.
<html> <body> <p>Date.parse() returns the number of milliseconds between the june 14, 1999 and January 1, 1970: </p> <script> var time = Date.parse("june 14, 1999"); document.write(time); </script> </body> </html>
Output
929298600000
- Related Questions & Answers
- What is the use of JavaScript cookies?
- What is the use of Map in JavaScript?
- What is the use of Atomics in JavaScript?
- What is the use of window.location in javascript?
- What is the use of sentry in javascript?
- What is the use of OBJECT.assign() in javascript?
- What is Implementation of LR Parsing Tables?
- What is the use of JavaScript eval function?
- What is Top-Down Parsing?
- What is Bottom-up Parsing?
- What is Operator Precedence Parsing?
- What is the use of declaring variables in JavaScript?
- What is the use of Math.clz32() method in JavaScript?
- What is the use of Math.imul( ) Function in JavaScript?
- What is the use of forEach() method in JavaScript?
Advertisements