JavaScript Date

const now = new Date();

Methods

MethodValueDescription
now.toDateString()Tue Aug 27 2019Converts the date portion of a Date object into a readable string
now.toISOString()2019-08-27T18:06:19.851ZReturns the date as a string, using the ISO standard
now.toJSON()2019-08-27T18:06:19.851ZReturns the date as a string, formatted as a JSON date
now.toLocaleDateString()2019-8-27Returns the date portion of a Date object as a string, using locale conventions
now.toLocaleTimeString()18:06:19Returns the time portion of a Date object as a string, using locale conventions
now.toLocaleString()2019-8-27 18:06:19Converts a Date object to a string, using locale conventions
now.toString()Tue Aug 27 2019 18:06:19 GMT+0000 (UTC)Converts a Date object to a string
now.toTimeString()18:06:19 GMT+0000 (UTC)Converts the time portion of a Date object to a string
now.toUTCString()Tue, 27 Aug 2019 18:06:19 GMTConverts a Date object to a string, according to universal time
now.getDate()27Returns the day of the month (from 1-31)
now.getDay()2Returns the day of the week (from 0-6)
now.getFullYear()2019Returns the year
now.getHours()18Returns the hour (from 0-23)
now.getMilliseconds()851Returns the milliseconds (from 0-999)
now.getMinutes()6Returns the minutes (from 0-59)
now.getMonth()7Returns the month (from 0-11)
now.getSeconds()19Returns the seconds (from 0-59)
now.getTime()1566929179851Returns 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()27Returns the day of the month, according to universal time (from 1-31)
now.getUTCDay()2Returns the day of the week, according to universal time (from 0-6)
now.getUTCFullYear()2019Returns the year, according to universal time
now.getUTCHours()18Returns the hour, according to universal time (from 0-23)
now.getUTCMilliseconds()851Returns the milliseconds, according to universal time (from 0-999)
now.getUTCMinutes()6Returns the minutes, according to universal time (from 0-59)
now.getUTCSeconds()19Returns the seconds, according to universal time (from 0-59)
now.valueOf()1566929179851Returns the primitive value of a Date object
Date.now()1566929179891Returns the number of milliseconds since midnight Jan 1, 1970
Date.parse('Tue Aug 27 2019')1566864000000Parses a date string and returns the number of milliseconds since January 1, 1970
Date.UTC( 2019, 7, 2, 18, 6, 19, 851, 1564769179851Accepts 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