Class Date
TopLevel
Class Date
Object
Date
A Date object contains a number indicating a particular instant in time to within a millisecond. The number may also be NaN, indicating that the Date object does not represent a specific instant of time.
Constructor Summary
Date()
Constructs the Date instance using the current date and time.
Date(millis : Number)
Constructs the Date instance using the specified milliseconds.
Date(year : Number, month : Number, args : Number...)
Constructs the Date instance using the specified year and month.
Date(dateString : String)
Constructs the Date instance by parsing the specified String.
Method Summary
getDate() : Number
Returns the day of the month where the value is a Number from 1 to 31.
getDay() : Number
Returns the day of the week where the value is a Number from 0 to 6.
getFullYear() : Number
Returns the year of the Date in four-digit format.
getHours() : Number
Return the hours field of the Date where the value is a Number from 0 (midnight) to 23 (11 PM).
getMilliseconds() : Number
Returns the milliseconds field of the Date.
getMinutes() : Number
Return the minutes field of the Date where the value is a Number from 0 to 59.
getMonth() : Number
Returns the month of the year as a value between 0 and 11.
getSeconds() : Number
Return the seconds field of the Date where the value is a Number from 0 to 59.
getTime() : Number
Returns the internal, millisecond representation of the Date object.
getTimezoneOffset() : Number
Returns the difference between local time and Greenwich Mean Time (GMT) in minutes.
getUTCDate() : Number
Returns the day of the month where the value is a Number from 1 to 31 when date is expressed in universal time.
getUTCDay() : Number
Returns the day of the week where the value is a Number from 0 to 6 when date is expressed in universal time.
getUTCFullYear() : Number
Returns the year when the Date is expressed in universal time.
getUTCHours() : Number
Return the hours field, expressed in universal time, of the Date where the value is a Number from 0 (midnight) to 23 (11 PM).
getUTCMilliseconds() : Number
Returns the milliseconds field, expressed in universal time, of the Date.
getUTCMinutes() : Number
Return the minutes field, expressed in universal time, of the Date where the value is a Number from 0 to 59.
getUTCMonth() : Number
Returns the month of the year that results when the Date is expressed in universal time.
getUTCSeconds() : Number
Return the seconds field, expressed in universal time, of the Date where the value is a Number from 0 to 59.
static now() : Number
Returns the number of milliseconds since midnight of January 1, 1970 up until now.
static parse(dateString : String) : Number
Takes a date string and returns the number of milliseconds since midnight of January 1, 1970.
setDate(date : Number) : Number
Sets the day of the month where the value is a Number from 1 to 31.
setFullYear(year : Number, args : Number...) : Number
Sets the full year of Date where the value must be a four-digit Number.
setHours(hours : Number, args : Number...) : Number
Sets the hours field of this Date instance.
setMilliseconds(millis : Number) : Number
Sets the milliseconds field of this Date instance.
setMinutes(minutes : Number, args : Number...) : Number
Sets the minutes field of this Date instance.
setMonth(month : Number, date : Number...) : Number
Sets the month of the year where the value is a Number from 0 to 11.
setSeconds(seconds : Number, millis : Number...) : Number
Sets the seconds field of this Date instance.
setTime(millis : Number) : Number
Sets the number of milliseconds between the desired date and time and January 1, 1970.
setUTCDate(date : Number) : Number
Sets the day of the month, expressed in universal time, where the value is a Number from 1 to 31.
setUTCFullYear(year : Number, args : Number...) : Number
Sets the full year, expressed in universal time, of Date where the value must be a four-digit Number.
setUTCHours(hours : Number, args : Number...) : Number
Sets the hours field, expressed in universal time, of this Date instance.
setUTCMilliseconds(millis : Number) : Number
Sets the milliseconds field, expressed in universal time, of this Date instance.
setUTCMinutes(minutes : Number, args : Number...) : Number
Sets the minutes field, expressed in universal time, of this Date instance.
setUTCMonth(month : Number, date : Number...) : Number
Sets the month of the year, expressed in universal time, where the value is a Number from 0 to 11.
setUTCSeconds(seconds : Number, millis : Number...) : Number
Sets the seconds field, expressed in universal time, of this Date instance.
toDateString() : String
Returns the Date as a String value where the value represents the date portion of the Date in the default locale (en_US).
toISOString() : String
This function returns a string value represent the instance in time represented by this Date object.
toJSON(key : String) : Object
This function returns the same string as Date.prototype.toISOString().
toLocaleDateString() : String
Returns the Date as a String value where the value represents the date portion of the Date in the default locale (en_US).
toLocaleString() : String
Returns the Date as a String using the default locale (en_US).
toLocaleTimeString() : String
Returns the Date as a String value where the value represents the time portion of the Date in the default locale (en_US).
toTimeString() : String
Returns the Date as a String value where the value represents the time portion of the Date in the default locale (en_US).
toUTCString() : String
Returns a String representation of this Date, expressed in universal time.
static UTC(year : Number, month : Number, args : Number...) : Number
Returns the number of milliseconds since midnight of January 1, 1970 according to universal time.
valueOf() : Object
Returns the value of this Date represented in milliseconds.
Constructor Detail
Date
public Date()
Constructs the Date instance using the current date and time.

Date
public Date(millis : Number)
Constructs the Date instance using the specified milliseconds.
Parameters:
millis - the number of milliseconds between the desired date and January 1, 1970 (UTC). For example, value of 10000 would create a Date instance representing 10 seconds past midnight on January 1, 1970.

Date
public Date(year : Number, month : Number, args : Number...)
Constructs the Date instance using the specified year and month. Optionally, you can pass up to five additional arguments representing date, hours, minutes, seconds, and milliseconds.
Parameters:
year - a number representing the year.
month - a number representing the month.
args - a set of numbers representing the date, hours, minutes, seconds, and milliseconds.

Date
public Date(dateString : String)
Constructs the Date instance by parsing the specified String.
Parameters:
dateString - represents a Date in a valid date format.

Method Detail
getDate
getDate() : Number
Returns the day of the month where the value is a Number from 1 to 31.
Returns:
the day of the month where the value is a Number from 1 to 31.

getDay
getDay() : Number
Returns the day of the week where the value is a Number from 0 to 6.
Returns:
the day of the month where the value is a Number from 0 to 6.

getFullYear
getFullYear() : Number
Returns the year of the Date in four-digit format.
Returns:
the year of the Date in four-digit format.

getHours
getHours() : Number
Return the hours field of the Date where the value is a Number from 0 (midnight) to 23 (11 PM).
Returns:
the hours field of the Date where the value is a Number from 0 (midnight) to 23 (11 PM).

getMilliseconds
getMilliseconds() : Number
Returns the milliseconds field of the Date.
Returns:
the milliseconds field of the Date.

getMinutes
getMinutes() : Number
Return the minutes field of the Date where the value is a Number from 0 to 59.
Returns:
the minutes field of the Date where the value is a Number from 0 to 59.

getMonth
getMonth() : Number
Returns the month of the year as a value between 0 and 11.
Returns:
the month of the year as a value between 0 and 11.

getSeconds
getSeconds() : Number
Return the seconds field of the Date where the value is a Number from 0 to 59.
Returns:
the seconds field of the Date where the value is a Number from 0 to 59.

getTime
getTime() : Number
Returns the internal, millisecond representation of the Date object. This value is independent of time zone.
Returns:
the internal, millisecond representation of the Date object.

getTimezoneOffset
getTimezoneOffset() : Number
Returns the difference between local time and Greenwich Mean Time (GMT) in minutes.
Returns:
the difference between local time and Greenwich Mean Time (GMT) in minutes.

getUTCDate
getUTCDate() : Number
Returns the day of the month where the value is a Number from 1 to 31 when date is expressed in universal time.
Returns:
the day of the month where the value is a Number from 1 to 31 when date is expressed in universal time.

getUTCDay
getUTCDay() : Number
Returns the day of the week where the value is a Number from 0 to 6 when date is expressed in universal time.
Returns:
the day of the week where the value is a Number from 0 to 6 when date is expressed in universal time.

getUTCFullYear
getUTCFullYear() : Number
Returns the year when the Date is expressed in universal time. The return value is a four-digit format.
Returns:
the year of the Date in four-digit form.

getUTCHours
getUTCHours() : Number
Return the hours field, expressed in universal time, of the Date where the value is a Number from 0 (midnight) to 23 (11 PM).
Returns:
the hours field, expressed in universal time, of the Date where the value is a Number from 0 (midnight) to 23 (11 PM).

getUTCMilliseconds
getUTCMilliseconds() : Number
Returns the milliseconds field, expressed in universal time, of the Date.
Returns:
the milliseconds field, expressed in universal time, of the Date.

getUTCMinutes
getUTCMinutes() : Number
Return the minutes field, expressed in universal time, of the Date where the value is a Number from 0 to 59.
Returns:
the minutes field, expressed in universal time, of the Date where the value is a Number from 0 to 59.

getUTCMonth
getUTCMonth() : Number
Returns the month of the year that results when the Date is expressed in universal time. The return value is a Number betwee 0 and 11.
Returns:
the month of the year as a value between 0 and 11.

getUTCSeconds
getUTCSeconds() : Number
Return the seconds field, expressed in universal time, of the Date where the value is a Number from 0 to 59.
Returns:
the seconds field, expressed in universal time, of the Date where the value is a Number from 0 to 59.

now
static now() : Number
Returns the number of milliseconds since midnight of January 1, 1970 up until now.
Returns:
the number of milliseconds since midnight of January 1, 1970.

parse
static parse(dateString : String) : Number
Takes a date string and returns the number of milliseconds since midnight of January 1, 1970.

Supports:

  • RFC2822 date strings
  • strings matching the exact ISO 8601 format 'YYYY-MM-DDTHH:mm:ss.sssZ'
Parameters:
dateString - represents a Date in a valid date format.
Returns:
the number of milliseconds since midnight of January 1, 1970 or NaN if no date could be recognized.

setDate
setDate(date : Number) : Number
Sets the day of the month where the value is a Number from 1 to 31.
Parameters:
date - the day of the month.
Returns:
the millisecond representation of the adjusted date.

setFullYear
setFullYear(year : Number, args : Number...) : Number
Sets the full year of Date where the value must be a four-digit Number. Optionally, you can set the month and date.
Parameters:
year - the year as a four-digit Number.
args - the month and day of the month.
Returns:
the millisecond representation of the adjusted date.

setHours
setHours(hours : Number, args : Number...) : Number
Sets the hours field of this Date instance. The minutes value should be a Number from 0 to 23. Optionally, hours, seconds and milliseconds can also be provided.
Parameters:
hours - the minutes field of this Date instance.
args - the hours, seconds and milliseconds values for this Date instance.
Returns:
the millisecond representation of the adjusted date.

setMilliseconds
setMilliseconds(millis : Number) : Number
Sets the milliseconds field of this Date instance.
Parameters:
millis - the milliseconds field of this Date instance.
Returns:
the millisecond representation of the adjusted date.

setMinutes
setMinutes(minutes : Number, args : Number...) : Number
Sets the minutes field of this Date instance. The minutes value should be a Number from 0 to 59. Optionally, seconds and milliseconds can also be provided.
Parameters:
minutes - the minutes field of this Date instance.
args - the seconds and milliseconds value for this Date instance.
Returns:
the millisecond representation of the adjusted date.

setMonth
setMonth(month : Number, date : Number...) : Number
Sets the month of the year where the value is a Number from 0 to 11. Optionally, you can set the day of the month.
Parameters:
month - the month of the year.
date - the day of the month.
Returns:
the millisecond representation of the adjusted date.

setSeconds
setSeconds(seconds : Number, millis : Number...) : Number
Sets the seconds field of this Date instance. The seconds value should be a Number from 0 to 59. Optionally, milliseconds can also be provided.
Parameters:
seconds - the seconds field of this Date instance.
millis - the milliseconds field of this Date instance.
Returns:
the millisecond representation of the adjusted date.

setTime
setTime(millis : Number) : Number
Sets the number of milliseconds between the desired date and time and January 1, 1970.
Parameters:
millis - the number of milliseconds between the desired date and time and January 1, 1970.
Returns:
the millisecond representation of the adjusted date.

setUTCDate
setUTCDate(date : Number) : Number
Sets the day of the month, expressed in universal time, where the value is a Number from 1 to 31.
Parameters:
date - the day of the month, expressed in universal time.
Returns:
the millisecond representation of the adjusted date.

setUTCFullYear
setUTCFullYear(year : Number, args : Number...) : Number
Sets the full year, expressed in universal time, of Date where the value must be a four-digit Number. Optionally, you can set the month and date.
Parameters:
year - the year as a four-digit Number, expressed in universal time.
args - the month and day of the month.
Returns:
the millisecond representation of the adjusted date.

setUTCHours
setUTCHours(hours : Number, args : Number...) : Number
Sets the hours field, expressed in universal time, of this Date instance. The minutes value should be a Number from 0 to 23. Optionally, seconds and milliseconds can also be provided.
Parameters:
hours - the minutes field, expressed in universal time, of this Date instance.
args - the seconds and milliseconds value, expressed in universal time, for this Date instance.
Returns:
the millisecond representation of the adjusted date.

setUTCMilliseconds
setUTCMilliseconds(millis : Number) : Number
Sets the milliseconds field, expressed in universal time, of this Date instance.
Parameters:
millis - the milliseconds field, expressed in universal time, of this Date instance.
Returns:
the millisecond representation of the adjusted date.

setUTCMinutes
setUTCMinutes(minutes : Number, args : Number...) : Number
Sets the minutes field, expressed in universal time, of this Date instance. The minutes value should be a Number from 0 to 59. Optionally, seconds and milliseconds can also be provided.
Parameters:
minutes - the minutes field, expressed in universal time, of this Date instance.
args - the seconds and milliseconds values, expressed in universal time, for this Date instance.
Returns:
the millisecond representation of the adjusted date.

setUTCMonth
setUTCMonth(month : Number, date : Number...) : Number
Sets the month of the year, expressed in universal time, where the value is a Number from 0 to 11. Optionally, you can set the day of the month.
Parameters:
month - the month of the year, expressed in universal time.
date - the day of the month.
Returns:
the millisecond representation of the adjusted date.

setUTCSeconds
setUTCSeconds(seconds : Number, millis : Number...) : Number
Sets the seconds field, expressed in universal time, of this Date instance. The seconds value should be a Number from 0 to 59. Optionally, milliseconds can also be provided.
Parameters:
seconds - the seconds field, expressed in universal time, of this Date instance.
millis - the milliseconds field, expressed in universal time, of this Date instance.
Returns:
the millisecond representation of the adjusted date.

toDateString
toDateString() : String
Returns the Date as a String value where the value represents the date portion of the Date in the default locale (en_US). To format a calendar object in an alternate format use the dw.util.StringUtils.formatCalendar() functions instead.
Returns:
the Date as a String value.

toISOString
toISOString() : String
This function returns a string value represent the instance in time represented by this Date object. The date is formatted with the Simplified ISO 8601 format as follows: YYYY-MM-DDTHH:mm:ss.sssTZ. The time zone is always UTC, denoted by the suffix Z.
Returns:
string representation of this date

toJSON
toJSON(key : String) : Object
This function returns the same string as Date.prototype.toISOString(). The method is called when a Date object is stringified.
Parameters:
key - the name of the key, which is stringified
Returns:
JSON string representation of this date

toLocaleDateString
toLocaleDateString() : String
Returns the Date as a String value where the value represents the date portion of the Date in the default locale (en_US). To format a calendar object in an alternate format use the dw.util.StringUtils.formatCalendar() functions instead.
Returns:
returns the date portion of the Date as a String.

toLocaleString
toLocaleString() : String
Returns the Date as a String using the default locale (en_US). To format a calendar object in an alternate format use the dw.util.StringUtils.formatCalendar() functions instead.
Returns:
the Date as a String using the default locale en_US

toLocaleTimeString
toLocaleTimeString() : String
Returns the Date as a String value where the value represents the time portion of the Date in the default locale (en_US). To format a calendar object in an alternate format use the dw.util.StringUtils.formatCalendar() functions instead.
Returns:
returns the time time's portion of the Date as a String.

toTimeString
toTimeString() : String
Returns the Date as a String value where the value represents the time portion of the Date in the default locale (en_US). To format a calendar object in an alternate format use the dw.util.StringUtils.formatCalendar() functions instead.
Returns:
the Date's time.

toUTCString
toUTCString() : String
Returns a String representation of this Date, expressed in universal time.
Returns:
a String representation of this Date, expressed in universal time.

UTC
static UTC(year : Number, month : Number, args : Number...) : Number
Returns the number of milliseconds since midnight of January 1, 1970 according to universal time. Optionally, you can pass up to five additional arguments representing date, hours, minutes, seconds, and milliseconds.
Parameters:
year - a number representing the year.
month - a number representing the month.
args - a set of numbers representing the date, hours, minutes, seconds, and milliseconds.
Returns:
the number of milliseconds since midnight of January 1, 1970 according to universal time.

valueOf
valueOf() : Object
Returns the value of this Date represented in milliseconds.
Returns:
the value of this Date represented in milliseconds.