This site runs best with JavaScript enabled.

JavaScript Date


const now = new Date();

Methods

MethodValueDescription
now.toDateString()Sat May 16 2020Converts the date portion of a Date object into a readable string
now.toISOString()2020-05-16T23:24:29.617ZReturns the date as a string, using the ISO standard
now.toJSON()2020-05-16T23:24:29.617ZReturns the date as a string, formatted as a JSON date
now.toLocaleDateString()5/16/2020Returns the date portion of a Date object as a string, using locale conventions
now.toLocaleTimeString()11:24:29 PMReturns the time portion of a Date object as a string, using locale conventions
now.toLocaleString()5/16/2020, 11:24:29 PMConverts a Date object to a string, using locale conventions
now.toString()Sat May 16 2020 23:24:29 GMT+0000 (Coordinated Universal Time)Converts a Date object to a string
now.toTimeString()23:24:29 GMT+0000 (Coordinated Universal Time)Converts the time portion of a Date object to a string
now.toUTCString()Sat, 16 May 2020 23:24:29 GMTConverts a Date object to a string, according to universal time
now.getDate()16Returns the day of the month (from 1-31)
now.getDay()6Returns the day of the week (from 0-6)
now.getFullYear()2020Returns the year
now.getHours()23Returns the hour (from 0-23)
now.getMilliseconds()617Returns the milliseconds (from 0-999)
now.getMinutes()24Returns the minutes (from 0-59)
now.getMonth()4Returns the month (from 0-11)
now.getSeconds()29Returns the seconds (from 0-59)
now.getTime()1589671469617Returns the number of milliseconds since midnight Jan 1 1970, and a specified date
now.getTimezoneOffset()0Returns the time difference between UTC time and local time, in minutes
now.getUTCDate()16Returns the day of the month, according to universal time (from 1-31)
now.getUTCDay()6Returns the day of the week, according to universal time (from 0-6)
now.getUTCFullYear()2020Returns the year, according to universal time
now.getUTCHours()23Returns the hour, according to universal time (from 0-23)
now.getUTCMilliseconds()617Returns the milliseconds, according to universal time (from 0-999)
now.getUTCMinutes()24Returns the minutes, according to universal time (from 0-59)
now.getUTCSeconds()29Returns the seconds, according to universal time (from 0-59)
now.valueOf()1589671469617Returns the primitive value of a Date object
Date.now()1589671469625Returns the number of milliseconds since midnight Jan 1, 1970
Date.parse('Sat May 16 2020')1589587200000Parses a date string and returns the number of milliseconds since January 1, 1970
Date.UTC( 2020, 4, 6, 23, 24, 29, 617, 1588807469617Accepts the same parameters as the Date constructor, but treats them as UTC. Returns the number of milliseconds since January 1, 1970, 00:00:00 UTC.
Share article