Skip to content
JavaScript

Date API Reference

JavaScript Date methods for reading and formatting dates and times.

By EZ4Code Team

Date

Represents a single moment in time (milliseconds since Unix epoch).

date.getDate()

Return the day of the month (1..31) in local time.

Returns: number

date.getMonth()

Return the month (0..11, where 0 = January) in local time.

Returns: number

date.getFullYear()

Return the 4-digit year in local time.

Returns: number

date.toISOString()

Return the date in ISO 8601 format (UTC): YYYY-MM-DDTHH:mm:ss.sssZ.

Returns: string

date.toLocaleDateString(locale?, options?)

Return a string with a language-sensitive representation of the date.

Returns: string

Date.now()

Static method. Return the number of milliseconds elapsed since Unix epoch.

Returns: number

Date.parse(dateString)

Static method. Parse a date string and return milliseconds since epoch, or NaN.

Returns: number

More JavaScript API References