Josh BucheaNotes

JavaScript Date

const now = new Date();

Methods

MethodValueDescription
now.toDateString()Mon Nov 18 2019Converts the date portion of a Date object into a readable string
now.toISOString()2019-11-18T01:28:46.331ZReturns the date as a string, using the ISO standard
now.toJSON()2019-11-18T01:28:46.331ZReturns the date as a string, formatted as a JSON date
now.toLocaleDateString()11/18/2019Returns the date portion of a Date object as a string, using locale conventions
now.toLocaleTimeString()1:28:46 AMReturns the time portion of a Date object as a string, using locale conventions
now.toLocaleString()11/18/2019, 1:28:46 AMConverts a Date object to a string, using locale conventions
now.toString()Mon Nov 18 2019 01:28:46 GMT+0000 (Coordinated Universal Time)Converts a Date object to a string
now.toTimeString()01:28:46 GMT+0000 (Coordinated Universal Time)Converts the time portion of a Date object to a string
now.toUTCString()Mon, 18 Nov 2019 01:28:46 GMTConverts a Date object to a string, according to universal time
now.getDate()18Returns 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()1Returns the hour (from 0-23)
now.getMilliseconds()331Returns the milliseconds (from 0-999)
now.getMinutes()28Returns the minutes (from 0-59)
now.getMonth()10Returns the month (from 0-11)
now.getSeconds()46Returns the seconds (from 0-59)
now.getTime()1574040526331Returns 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()18Returns 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()1Returns the hour, according to universal time (from 0-23)
now.getUTCMilliseconds()331Returns the milliseconds, according to universal time (from 0-999)
now.getUTCMinutes()28Returns the minutes, according to universal time (from 0-59)
now.getUTCSeconds()46Returns the seconds, according to universal time (from 0-59)
now.valueOf()1574040526331Returns the primitive value of a Date object
Date.now()1574040526338Returns the number of milliseconds since midnight Jan 1, 1970
Date.parse('Mon Nov 18 2019')1574035200000Parses a date string and returns the number of milliseconds since January 1, 1970
Date.UTC( 2019, 10, 1, 1, 28, 46, 331, 1572571726331Accepts 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.
Follow me on Twitter