Basic JavaScript Question:
Download Job Interview Questions and Answers PDF
What's the Date object using JavaScript?
Answer:
Time inside a date object is stored as milliseconds since Jan 1, 1970 in JavaScript.
e.g.
new Date(06,01,02) // produces "Fri Feb 02 1906 00:00:00 GMT-0600 (Central Standard Time)"
new Date(06,01,02).toLocaleString() // produces "Friday, February 02, 1906 00:00:00"
new Date(06,01,02) - new Date(06,01,01) // produces "86400000"
e.g.
new Date(06,01,02) // produces "Fri Feb 02 1906 00:00:00 GMT-0600 (Central Standard Time)"
new Date(06,01,02).toLocaleString() // produces "Friday, February 02, 1906 00:00:00"
new Date(06,01,02) - new Date(06,01,01) // produces "86400000"
Download JavaScript Interview Questions And Answers
PDF
Previous Question | Next Question |
What's Math Constants and Functions using JavaScript? | What does the delete operator do? |