Date

Overview

The javascript Date implementation.

For more information see: Date (MDN).

Methods Summarized

TypeNameSummary

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 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 year in UTC time.

void

Sets the hours in UTC time.

void

Sets the hours 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 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

// The number of milliseconds in the first minute after 1970 January 1st.
application.output(Date.UTC(1970, 00, 01, 00, 01, 00, 00)); // prints: 60000.0

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

// The number of milliseconds in the first minute after 1970 January 1st.
application.output(Date.UTC(1970, 00, 01, 00, 01, 00, 00)); // prints: 60000.0

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

// The number of milliseconds in the first minute after 1970 January 1st.
application.output(Date.UTC(1970, 00, 01, 00, 01, 00, 00)); // prints: 60000.0

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

// The number of milliseconds in the first minute after 1970 January 1st.
application.output(Date.UTC(1970, 00, 01, 00, 01, 00, 00)); // prints: 60000.0

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

// The number of milliseconds in the first minute after 1970 January 1st.
application.output(Date.UTC(1970, 00, 01, 00, 01, 00, 00)); // prints: 60000.0

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

// The number of milliseconds in the first minute after 1970 January 1st.
application.output(Date.UTC(1970, 00, 01, 00, 01, 00, 00)); // prints: 60000.0

getDate()

Gets the day of month in local time

Returns: Number

Sample

date.getDate();

getDay()

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

Returns: Number

Sample

date.getDay();

getFullYear()

Gets the full year of the date in local time

Returns: Number

Sample

date.getFullYear();

getHours()

Gets the hours of the date in local time

Returns: Number

Sample

date.getHours();

getMilliseconds()

Gets the milliseconds of the date in local time

Returns: Number

Sample

date.getMilliseconds();

getMinutes()

Gets the minutes of the date in local time

Returns: Number

Sample

date.getMinutes();

getMonth()

Gets the month of the date in local time

Returns: Number

Sample

date.getMonth();

getSeconds()

Gets the seconds of the date in local time

Returns: Number

Sample

date.getSeconds();

getTime()

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

Returns: Number

Sample

date.getTime();

getTimezoneOffset()

Gets the number of minutes between GMT and this date.

Returns: Number

Sample

date.getTimezoneOffset();

getUTCDate()

Gets the UTC date.

Returns: Number

Sample

date.getUTCDate();

getUTCDay()

Gets the day in UTC time.

Returns: Number

Sample

date.getUTCDay();

getUTCFullYear()

Gets the full year in UTC time.

Returns: Number

Sample

date.getUTCFullYear();

getUTCHours()

Gets the hours in UTC time.

Returns: Number

Sample

date.getUTCHours();

getUTCMilliseconds()

Gets the milliseconds in UTC time.

Returns: Number

Sample

date.getUTCMilliseconds();

getUTCMinutes()

Gets the minutes in UTC time.

Returns: Number

Sample

date.getUTCMinutes();

getUTCMonth()

Gets the month in UTC time.

Returns: Number

Sample

date.getUTCMonth();

getUTCSeconds()

Gets the seconds in UTC time.

Returns: Number

Sample

date.getUTCSeconds();

now()

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

Returns: Number

Sample

var timestamp = Date.now();

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

var str = Date.parse("Wed, 09 Aug 1995 00:00:00 GMT");
application.output(str);

setDate(dayValue)

Sets the date.

Parameters

Returns: void

Sample

date.setDate(integer);

setFullYear(yearValue)

Sets the full year of the date.

Parameters

Returns: void

Sample

date.setFullYear(integer);

setFullYear(yearValue, monthValue)

Sets the full year of the date.

Parameters

Returns: void

Sample

date.setFullYear(integer);

setFullYear(yearValue, monthValue, dayValue)

Sets the full year of the date.

Parameters

Returns: void

Sample

date.setFullYear(integer);

setHours(hoursValue)

Sets the hours of the date.

Parameters

Returns: void

Sample

date.setHours(integer);

setHours(hoursValue, minutesValue)

Sets the hours of the date.

Parameters

Returns: void

Sample

date.setHours(integer);

setHours(hoursValue, minutesValue, secondsValue)

Sets the hours of the date.

Parameters

Returns: void

Sample

date.setHours(integer);

setHours(hoursValue, minutesValue, secondsValue, msValue)

Sets the hours of the date.

Parameters

Returns: void

Sample

date.setHours(integer);

setMilliseconds(millisecondsValue)

Sets the milliseconds of the date.

Parameters

Returns: void

Sample

date.setMilliseconds(integer);

setMinutes(minutesValue)

Sets the minutes of the date.

Parameters

Returns: void

Sample

date.setMinutes(integer);

setMinutes(minutesValue, secondsValue)

Sets the minutes of the date.

Parameters

Returns: void

Sample

date.setMinutes(integer);

setMinutes(minutesValue, secondsValue, msValue)

Sets the minutes of the date.

Parameters

Returns: void

Sample

date.setMinutes(integer);

setMonth(monthValue)

Sets the month of the date.

Parameters

Returns: void

Sample

date.setMonth(integr);

setMonth(monthValue, dayValue)

Sets the month of the date.

Parameters

Returns: void

Sample

date.setMonth(integr);

setSeconds(secondsValue)

Sets the seconds of the date.

Parameters

Returns: void

Sample

date.setSeconds(integer);

setSeconds(secondsValue, msValue)

Sets the seconds of the date.

Parameters

Returns: void

Sample

date.setSeconds(integer);

setTime(timeValue)

Sets the milliseconds of the date.

Parameters

Returns: void

Sample

date.setTime(integer);

setUTCDate(dayValue)

Sets the UTC date.

Parameters

Returns: void

Sample

date.setUTCDate(integer);

setUTCFullYear(yearValue)

Sets the year in UTC time.

Parameters

Returns: void

Sample

date.setUTCFullYear(integer);

setUTCFullYear(yearValue, monthValue)

Sets the year in UTC time.

Parameters

Returns: void

Sample

date.setUTCFullYear(integer);

setUTCFullYear(yearValue, monthValue, dayValue)

Sets the year in UTC time.

Parameters

Returns: void

Sample

date.setUTCFullYear(integer);

setUTCHours(hoursValue)

Sets the hours in UTC time.

Parameters

Returns: void

Sample

date.setUTCHours(integer);

setUTCHours(hoursValue, minutesValue)

Sets the hours in UTC time.

Parameters

Returns: void

Sample

date.setUTCHours(integer);

setUTCHours(hoursValue, minutesValue, secondsValue)

Sets the hours in UTC time.

Parameters

Returns: void

Sample

date.setUTCHours(integer);

setUTCHours(hoursValue, minutesValue, secondsValue, msValue)

Sets the hours in UTC time.

Parameters

Returns: void

Sample

date.setUTCHours(integer);

setUTCMilliseconds(millisecondsValue)

Sets the milliseconds in UTC time.

Parameters

Returns: void

Sample

date.setUTCMilliseconds(integer);

setUTCMinutes(minutesValue)

Sets the minutes in UTC time.

Parameters

Returns: void

Sample

date.setUTCMinutes(integer);

setUTCMinutes(minutesValue, secondsValue)

Sets the minutes in UTC time.

Parameters

Returns: void

Sample

date.setUTCMinutes(integer);

setUTCMinutes(minutesValue, secondsValue, msValue)

Sets the minutes in UTC time.

Parameters

Returns: void

Sample

date.setUTCMinutes(integer);

setUTCMonth(monthValue)

Sets the month in UTC time.

Parameters

Returns: void

Sample

date.setUTCMonth(integer);

setUTCMonth(monthValue, dayValue)

Sets the month in UTC time.

Parameters

Returns: void

Sample

date.setUTCMonth(integer);

setUTCSeconds(secondsValue)

Sets the seconds in UTC time.

Parameters

Returns: void

Sample

date.setUTCSeconds(integer);

setUTCSeconds(secondsValue, msValue)

Sets the seconds in UTC time.

Parameters

Returns: void

Sample

date.setUTCSeconds(integer);

toDateString()

Returns a string version of the date.

Returns: String

Sample

date.toDateString();

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

date.toISOString();

toLocaleDateString()

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

Returns: String

Sample

date.toLocaleDateString();

toLocaleString()

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

Returns: String

Sample

date.toLocaleString();

toLocaleTimeString()

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

Returns: String

Sample

date.toLocaleTimeString();

toTimeString()

Returns a string version of the date.

Returns: String

Sample

date.toTimeString();

toUTCString()

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

Returns: String

Sample

date.toUTCString();

valueOf()

Return integer milliseconds count

Returns: Number

Sample

date.valueOf(integer);

Last updated