Javascript get current timetamp

·

1 min read

//gets the number of milliseconds elapsed since January 1, 1970 00:00:00 UTC
Date.now()

Simply Date.now() returns the number of milliseconds that has elapsed since January 1, 1970 00:00:00 UTC.

You maybe asking why January 1, 1970 00:00:00 UTC. January 1, 1970 00:00:00 UTC is an arbitrary date set by Unix engineers as a uniform/standard date for the beginning of time.

Get day of the month

new Date().getDate()

Get Day of the week

new Date().getDay();

Get Month of the year

//returns month of the year zero based month+1
new Date().getMonth();