Josh Buchea

JavaScript Date

const now = new Date();

Methods

MethodValueDescription
now.toDateString()Sun Jun 02 2019Converts the date portion of a Date object into a readable string
now.toISOString()2019-06-02T23:33:45.134ZReturns the date as a string, using the ISO standard
now.toJSON()2019-06-02T23:33:45.134ZReturns the date as a string, formatted as a JSON date
now.toLocaleDateString()2019-6-2Returns the date portion of a Date object as a string, using locale conventions
now.toLocaleTimeString()23:33:45Returns the time portion of a Date object as a string, using locale conventions
now.toLocaleString()2019-6-2 23:33:45Converts a Date object to a string, using locale conventions
now.toString()Sun Jun 02 2019 23:33:45 GMT+0000 (UTC)Converts a Date object to a string
now.toTimeString()23:33:45 GMT+0000 (UTC)Converts the time portion of a Date object to a string
now.toUTCString()Sun, 02 Jun 2019 23:33:45 GMTConverts a Date object to a string, according to universal time
now.getDate()2Returns the day of the month (from 1-31)
now.getDay()0Returns the day of the week (from 0-6)
now.getFullYear()2019Returns the year
now.getHours()23Returns the hour (from 0-23)
now.getMilliseconds()134Returns the milliseconds (from 0-999)
now.getMinutes()33Returns the minutes (from 0-59)
now.getMonth()5Returns the month (from 0-11)
now.getSeconds()45Returns the seconds (from 0-59)
now.getTime()1559518425134Returns 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()2Returns the day of the month, according to universal time (from 1-31)
now.getUTCDay()0Returns the day of the week, according to universal time (from 0-6)
now.getUTCFullYear()2019Returns the year, according to universal time
now.getUTCHours()23Returns the hour, according to universal time (from 0-23)
now.getUTCMilliseconds()134Returns the milliseconds, according to universal time (from 0-999)
now.getUTCMinutes()33Returns the minutes, according to universal time (from 0-59)
now.getUTCSeconds()45Returns the seconds, according to universal time (from 0-59)
now.valueOf()1559518425134Returns the primitive value of a Date object
Date.now()1559518425179Returns the number of milliseconds since midnight Jan 1, 1970
Date.parse('Sun Jun 02 2019')1559433600000Parses a date string and returns the number of milliseconds since January 1, 1970
Date.UTC( 2019, 5, 0, 23, 33, 45, 134, 1559345625134Accepts 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