JavaScript Date

const now = new Date();

Methods

MethodValueDescription
now.toDateString()Mon Jul 22 2019Converts the date portion of a Date object into a readable string
now.toISOString()2019-07-22T22:31:01.440ZReturns the date as a string, using the ISO standard
now.toJSON()2019-07-22T22:31:01.440ZReturns the date as a string, formatted as a JSON date
now.toLocaleDateString()2019-7-22Returns the date portion of a Date object as a string, using locale conventions
now.toLocaleTimeString()22:31:01Returns the time portion of a Date object as a string, using locale conventions
now.toLocaleString()2019-7-22 22:31:01Converts a Date object to a string, using locale conventions
now.toString()Mon Jul 22 2019 22:31:01 GMT+0000 (UTC)Converts a Date object to a string
now.toTimeString()22:31:01 GMT+0000 (UTC)Converts the time portion of a Date object to a string
now.toUTCString()Mon, 22 Jul 2019 22:31:01 GMTConverts a Date object to a string, according to universal time
now.getDate()22Returns the day of the month (from 1-31)
now.getDay()1Returns the day of the week (from 0-6)
now.getFullYear()2019Returns the year
now.getHours()22Returns the hour (from 0-23)
now.getMilliseconds()440Returns the milliseconds (from 0-999)
now.getMinutes()31Returns the minutes (from 0-59)
now.getMonth()6Returns the month (from 0-11)
now.getSeconds()1Returns the seconds (from 0-59)
now.getTime()1563834661440Returns 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()22Returns the day of the month, according to universal time (from 1-31)
now.getUTCDay()1Returns the day of the week, according to universal time (from 0-6)
now.getUTCFullYear()2019Returns the year, according to universal time
now.getUTCHours()22Returns the hour, according to universal time (from 0-23)
now.getUTCMilliseconds()440Returns the milliseconds, according to universal time (from 0-999)
now.getUTCMinutes()31Returns the minutes, according to universal time (from 0-59)
now.getUTCSeconds()1Returns the seconds, according to universal time (from 0-59)
now.valueOf()1563834661440Returns the primitive value of a Date object
Date.now()1563834661469Returns the number of milliseconds since midnight Jan 1, 1970
Date.parse('Mon Jul 22 2019')1563753600000Parses a date string and returns the number of milliseconds since January 1, 1970
Date.UTC( 2019, 6, 1, 22, 31, 1, 440, 1562020261440Accepts 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.

May 18, 2019