Date

Overview

The javascript Date implementation.

For more information see: Date (MDN).

Methods Summarized

Type
Name
Summary

Takes comma-delimited date parameters and returns the number of milliseconds between January 1, 1970, 00:00:00, universal time and the specified time.

Takes comma-delimited date parameters and returns the number of milliseconds between January 1, 1970, 00:00:00, universal time and the specified time.

Takes comma-delimited date parameters and returns the number of milliseconds between January 1, 1970, 00:00:00, universal time and the specified time.

Takes comma-delimited date parameters and returns the number of milliseconds between January 1, 1970, 00:00:00, universal time and the specified time.

Takes comma-delimited date parameters and returns the number of milliseconds between January 1, 1970, 00:00:00, universal time and the specified time.

Takes comma-delimited date parameters and returns the number of milliseconds between January 1, 1970, 00:00:00, universal time and the specified time.

Gets the day of month in local time

Gets the day of the week (sunday = 0) in local time

Gets the full year of the date in local time

Gets the hours of the date in local time

Gets the milliseconds of the date in local time

Gets the minutes of the date in local time

Gets the month of the date in local time

Gets the seconds of the date in local time

The value returned by the getTime method is the number of milliseconds since 1 January 1970 00:00:00.

Gets the number of minutes between GMT and this date.

Gets the UTC date.

Gets the day in UTC time.

Gets the full year in UTC time.

Gets the hours in UTC time.

Gets the milliseconds in UTC time.

Gets the minutes in UTC time.

Gets the month in UTC time.

Gets the seconds in UTC time.

Returns the milliseconds elapsed since 1 January 1970 00:00:00 UTC up until now.

Takes a date string (such as "Dec 25, 1995") and returns the number of milliseconds since January 1, 1970, 00:00:00 UTC.

void

Sets the date.

void

Sets the full year of the date.

void

Sets the full year of the date.

void

Sets the full year of the date.

void

Sets the hours of the date.

void

Sets the hours of the date.

void

Sets the milliseconds of the date.

void

Sets the minutes of the date.

void

Sets the minutes of the date.

void

Sets the minutes of the date.

void

Sets the month of the date.

void

Sets the month of the date.

void

Sets the seconds of the date.

void

Sets the seconds of the date.

void

Sets the milliseconds of the date.

void

Sets the UTC date.

void

Sets the year in UTC time.

void

Sets the year in UTC time.

void

Sets the hours in UTC time.

void

Sets the hours in UTC time.

void

Sets the milliseconds in UTC time.

void

Sets the minutes in UTC time.

void

Sets the minutes in UTC time.

void

Sets the month in UTC time.

void

Sets the month in UTC time.

void

Sets the seconds in UTC time.

void

Sets the seconds in UTC time.

Returns a string version of the date.

Returns a string version of the UTC value of the date.

Returns a string version of the local time zone of the date.

Returns a string version of the local time zone of the date.

Returns a string version of the local time zone of the date.

Returns a string version of the date.

Returns a string version of the UTC value of the date.

Return integer milliseconds count

Methods Detailed

UTC(year, month)

Takes comma-delimited date parameters and returns the number of milliseconds between January 1, 1970, 00:00:00, universal time and the specified time.

Parameters

  • Number year A year after 1900.

  • Number month A number between 0 and 11.

Returns: Number

Sample

UTC(year, month, date)

Takes comma-delimited date parameters and returns the number of milliseconds between January 1, 1970, 00:00:00, universal time and the specified time.

Parameters

  • Number year A year after 1900.

  • Number month A number between 0 and 11.

  • Number date A number between 1 and 31.

Returns: Number

Sample

UTC(year, month, date, hrs)

Takes comma-delimited date parameters and returns the number of milliseconds between January 1, 1970, 00:00:00, universal time and the specified time.

Parameters

  • Number year A year after 1900.

  • Number month A number between 0 and 11.

  • Number date A number between 1 and 31.

  • Number hrs A number between 0 and 23.

Returns: Number

Sample

UTC(year, month, date, hrs, min)

Takes comma-delimited date parameters and returns the number of milliseconds between January 1, 1970, 00:00:00, universal time and the specified time.

Parameters

  • Number year A year after 1900.

  • Number month A number between 0 and 11.

  • Number date A number between 1 and 31.

  • Number hrs A number between 0 and 23.

  • Number min A number between 0 and 59.

Returns: Number

Sample

UTC(year, month, date, hrs, min, sec)

Takes comma-delimited date parameters and returns the number of milliseconds between January 1, 1970, 00:00:00, universal time and the specified time.

Parameters

  • Number year A year after 1900.

  • Number month A number between 0 and 11.

  • Number date A number between 1 and 31.

  • Number hrs A number between 0 and 23.

  • Number min A number between 0 and 59.

  • Number sec A number between 0 and 59.

Returns: Number

Sample

UTC(year, month, date, hrs, min, sec, ms)

Takes comma-delimited date parameters and returns the number of milliseconds between January 1, 1970, 00:00:00, universal time and the specified time.

Parameters

  • Number year A year after 1900.

  • Number month A number between 0 and 11.

  • Number date A number between 1 and 31.

  • Number hrs A number between 0 and 23.

  • Number min A number between 0 and 59.

  • Number sec A number between 0 and 59.

  • Number ms A number between 0 and 999.

Returns: Number

Sample

getDate()

Gets the day of month in local time

Returns: Number

Sample

getDay()

Gets the day of the week (sunday = 0) in local time

Returns: Number

Sample

getFullYear()

Gets the full year of the date in local time

Returns: Number

Sample

getHours()

Gets the hours of the date in local time

Returns: Number

Sample

getMilliseconds()

Gets the milliseconds of the date in local time

Returns: Number

Sample

getMinutes()

Gets the minutes of the date in local time

Returns: Number

Sample

getMonth()

Gets the month of the date in local time

Returns: Number

Sample

getSeconds()

Gets the seconds of the date in local time

Returns: Number

Sample

getTime()

The value returned by the getTime method is the number of milliseconds since 1 January 1970 00:00:00.

Returns: Number

Sample

getTimezoneOffset()

Gets the number of minutes between GMT and this date.

Returns: Number

Sample

getUTCDate()

Gets the UTC date.

Returns: Number

Sample

getUTCDay()

Gets the day in UTC time.

Returns: Number

Sample

getUTCFullYear()

Gets the full year in UTC time.

Returns: Number

Sample

getUTCHours()

Gets the hours in UTC time.

Returns: Number

Sample

getUTCMilliseconds()

Gets the milliseconds in UTC time.

Returns: Number

Sample

getUTCMinutes()

Gets the minutes in UTC time.

Returns: Number

Sample

getUTCMonth()

Gets the month in UTC time.

Returns: Number

Sample

getUTCSeconds()

Gets the seconds in UTC time.

Returns: Number

Sample

now()

Returns the milliseconds elapsed since 1 January 1970 00:00:00 UTC up until now.

Returns: Number

Sample

parse(s)

Takes a date string (such as "Dec 25, 1995") and returns the number of milliseconds since January 1, 1970, 00:00:00 UTC.

Parameters

  • String s The date string to parse

Returns: Number

Sample

setDate(dayValue)

Sets the date.

Parameters

Returns: void

Sample

setFullYear(yearValue)

Sets the full year of the date.

Parameters

Returns: void

Sample

setFullYear(yearValue, monthValue)

Sets the full year of the date.

Parameters

Returns: void

Sample

setFullYear(yearValue, monthValue, dayValue)

Sets the full year of the date.

Parameters

Returns: void

Sample

setHours(hoursValue)

Sets the hours of the date.

Parameters

Returns: void

Sample

setHours(hoursValue, minutesValue)

Sets the hours of the date.

Parameters

Returns: void

Sample

setHours(hoursValue, minutesValue, secondsValue)

Sets the hours of the date.

Parameters

Returns: void

Sample

setHours(hoursValue, minutesValue, secondsValue, msValue)

Sets the hours of the date.

Parameters

Returns: void

Sample

setMilliseconds(millisecondsValue)

Sets the milliseconds of the date.

Parameters

Returns: void

Sample

setMinutes(minutesValue)

Sets the minutes of the date.

Parameters

Returns: void

Sample

setMinutes(minutesValue, secondsValue)

Sets the minutes of the date.

Parameters

Returns: void

Sample

setMinutes(minutesValue, secondsValue, msValue)

Sets the minutes of the date.

Parameters

Returns: void

Sample

setMonth(monthValue)

Sets the month of the date.

Parameters

Returns: void

Sample

setMonth(monthValue, dayValue)

Sets the month of the date.

Parameters

Returns: void

Sample

setSeconds(secondsValue)

Sets the seconds of the date.

Parameters

Returns: void

Sample

setSeconds(secondsValue, msValue)

Sets the seconds of the date.

Parameters

Returns: void

Sample

setTime(timeValue)

Sets the milliseconds of the date.

Parameters

Returns: void

Sample

setUTCDate(dayValue)

Sets the UTC date.

Parameters

Returns: void

Sample

setUTCFullYear(yearValue)

Sets the year in UTC time.

Parameters

Returns: void

Sample

setUTCFullYear(yearValue, monthValue)

Sets the year in UTC time.

Parameters

Returns: void

Sample

setUTCFullYear(yearValue, monthValue, dayValue)

Sets the year in UTC time.

Parameters

Returns: void

Sample

setUTCHours(hoursValue)

Sets the hours in UTC time.

Parameters

Returns: void

Sample

setUTCHours(hoursValue, minutesValue)

Sets the hours in UTC time.

Parameters

Returns: void

Sample

setUTCHours(hoursValue, minutesValue, secondsValue)

Sets the hours in UTC time.

Parameters

Returns: void

Sample

setUTCHours(hoursValue, minutesValue, secondsValue, msValue)

Sets the hours in UTC time.

Parameters

Returns: void

Sample

setUTCMilliseconds(millisecondsValue)

Sets the milliseconds in UTC time.

Parameters

Returns: void

Sample

setUTCMinutes(minutesValue)

Sets the minutes in UTC time.

Parameters

Returns: void

Sample

setUTCMinutes(minutesValue, secondsValue)

Sets the minutes in UTC time.

Parameters

Returns: void

Sample

setUTCMinutes(minutesValue, secondsValue, msValue)

Sets the minutes in UTC time.

Parameters

Returns: void

Sample

setUTCMonth(monthValue)

Sets the month in UTC time.

Parameters

Returns: void

Sample

setUTCMonth(monthValue, dayValue)

Sets the month in UTC time.

Parameters

Returns: void

Sample

setUTCSeconds(secondsValue)

Sets the seconds in UTC time.

Parameters

Returns: void

Sample

setUTCSeconds(secondsValue, msValue)

Sets the seconds in UTC time.

Parameters

Returns: void

Sample

toDateString()

Returns a string version of the date.

Returns: String

Sample

toISOString()

Returns a string version of the UTC value of the date.

Returns: String the Date object as a string in simplified extended ISO format.

Sample

toLocaleDateString()

Returns a string version of the local time zone of the date.

Returns: String

Sample

toLocaleString()

Returns a string version of the local time zone of the date.

Returns: String

Sample

toLocaleTimeString()

Returns a string version of the local time zone of the date.

Returns: String

Sample

toTimeString()

Returns a string version of the date.

Returns: String

Sample

toUTCString()

Returns a string version of the UTC value of the date.

Returns: String

Sample

valueOf()

Return integer milliseconds count

Returns: Number

Sample


Last updated

Was this helpful?