Date API

Creating, getting, and manipulating dates and times.

Date objects represent points in time independent of any particular time zone. A Date object is created with new Date() and contains a Number that represents milliseconds since January 1, 1970, 00:00:00 UTC.

The Date constructor provides various forms for creating date objects based on the current date/time, specified date/time components, timestamps, or date strings. Methods such as getDate(), getMonth(), and getFullYear() extract date components, while setDate(), setMonth(), and setFullYear() modify date values. Time-specific methods like getHours(), getMinutes(), getSeconds() and their setter counterparts handle time components.

Date objects include conversion methods like toLocaleDateString() and toLocaleTimeString() for local formatting, and toISOString() for standardized string representation. Calculation methods such as getTime() and valueOf() provide timestamps, enabling date arithmetic.

13 Total 13 Methods 0 Properties 5 Statics
  Show all

Date()

Returns a string representation of the current date and time.Date()

new Date(…)

Creates a Date object representing a specific point in time.Date.new Date([value, [year, [month, [day, [hour, [minute, [second, [millisecond]]]]]]]])

Date.UTC(…)

Accepts the same parameters as the Date constructor but treats them as UTC.Date.UTC(year, [month, [day, [hour, [minute, [second, [millisecond]]]]]])

getDate()

Returns the day of the month (1-31) for the specified date according to local time.d.getDate()

getDay()

Returns the day of the week (0-6) for the specified date according to local time.d.getDay()

getFullYear()

Returns the year (4 digits) for the specified date according to local time.d.getFullYear()

getMonth()

Returns the month (0-11) for the specified date according to local time.d.getMonth()

Date.now()

Returns the numeric value corresponding to the current time - the number of milliseconds elapsed since January 1, 1970 00:00:00 UTC.Date.now()

Date.parse(…)

Parses a string representation of a date and returns the number of milliseconds since January 1, 1970, 00:00:00 UTC.Date.parse(dateString)

toISOString()

Returns a string in ISO format (YYYY-MM-DDTHH:mm:ss.sssZ) representing the date.d.toISOString()

toJSON()

Returns a string representation of the Date object as a JSON value.d.toJSON()

toString()

Returns a string representing the specified Date object.d.toString()

valueOf()

Returns the primitive value of a Date object as milliseconds since January 1, 1970, 00:00:00 UTC.d.valueOf()

Date.UTC(…)

staticmethod

Accepts the same parameters as the Date constructor but treats them as UTC. Date.UTC(year, [month, [day, [hour, [minute, [second, [millisecond]]]]]])

Arguments

year – Integer value representing the year.
month – Integer value representing the month, beginning with 0 for January.
day – Integer value representing the day of the month.
hour – Integer value representing the hour of the day.
minute – Integer value representing the minute segment of a time.
second – Integer value representing the second segment of a time.
millisecond – Integer value representing the millisecond segment of a time.

You seem to be offline. App may not work.