dat object js code example
Example 1: js time
Pulling Date and Time Values
getDate()
Get the day of the month as a number (1-31)
getDay()
The weekday as a number (0-6)
getFullYear()
Year as a four digit number (yyyy)
getHours()
Get the hour (0-23)
getMilliseconds()
The millisecond (0-999)
getMinutes()
Get the minute (0-59)
getMonth()
Month as a number (0-11)
getSeconds()
Get the second (0-59)
getTime()
Get the milliseconds since January 1, 1970
getUTCDate()
The day (date) of the month in the specified date according to universal time (also available for
day, month, fullyear, hours, minutes etc.)
parse
Parses a string representation of a date, and returns the number of milliseconds since January
Example 2: dates in javascript
new Date();
// Sat Jan 16 2021 22:08:57 GMT-0500 (Eastern Standard Time)
Date.now();
// 1610852869057 -> Seconds passed since Jan 1,1970
// Set the date
new Date(year, month, day hours, minutes, seconds, milliseconds)