JavaScript parse date
In this section, you will learn how to parse the date in JavaScript.
JavaScript provides the function parse() that takes a date in string format and returns the equivalent number of milliseconds elapsed since 1 Jan 1970. In the given example we have passed date March 7, 2009 to the method parse() which returns the number of milliseconds since January 1, 1970 to March 7, 2009.
Here is the code:
| <html> <h2>Parse Date</h2> <script type="text/javascript"> var parseCurrentDate = Date.parse("March 7, 2009"); document.write("The number of milliseconds since 01/01/1970 to 07/03/2009 : "+parseCurrentDate); </script> </html> |
Output will be displayed as:
Tutorials
- Clear cookie example
- JavaScript getElementById innerHTML
- JavaScript getElementById Style
- Javascript Examples
- JavaScript add row dynamically to table
- New Page 1
- JavaScript Change link
- JavaScript Checkbox getElementById
- javascript clear textarea
- JavaScript Clock Timer
- JavaScript Cookies
- JavaScript Date Difference
- JavaScript duplicate string
- JavaScript Email Validation
- javascript focus input
- JavaScript get excel file data
- JavaScript getAttribute Href
- JavaScript getAttribute Style
- JavaScript getElementById div
- JavaScript getElementById Iframe
- JavaScript getElementById select
- JavaScript Hide Button
- JavaScript Hide Div
- JavaScript hide image
- JavaScript Hide Table Column
- JavaScript Hide Table Rows
- JavaScript Key Event
- JavaScript link
- JavaScript method location
- JavaScript move div
- JavaScript move file
- JavaScript move image
- JavaScript Navigate Back
- JavaScript navigate to page
- JavaScript Navigate to URL
- JavaScript indexOf substring
- JavaScript onkeypress event
- JavaScript Open file
- JavaScript Open link in new window
- JavaScript Open Modal Window


