Date
QuickLinks
Methods
Constructor
Date Date (year:
number[, month:
number=0][, day:
number=0][, hours:
number=0][, min:
number=0][, sec:
number=0][, ms:
number=0])
Returns a new Date object holding the current date and time.
If parameters are supplied, returns a new Date object holding the supplied date and time.
Parameter | Type | Description |
---|---|---|
year | number | The year expressed in four digits. |
month | number (range: 0 - 11) | An integer value from 0 (Jan) to 11 (Dec). (default: 0) (Optional) |
day | number (range: 1 - 31) | An integer value from 1 to 31, If this argument is not supplied, its value is set to 0. (default: 0) (Optional) |
hours | number (range: 0 - 23) | An integer value from 0 (midnight) to 23 (11 PM). If this argument is not supplied, its value is set to 0. (default: 0) (Optional) |
min | number (range: 0 - 59) | An integer value from 0 to 59. If this argument is not supplied, its value is set to 0. (default: 0) (Optional) |
sec | number (range: 0 - 59) | An Integer value from 0 to 59. If this argument is not supplied, its value is set to 0. (default: 0) (Optional) |
ms | number (range: 0 - 999) | An integer value from 0 to 999. If this argument is not supplied, its value is set to 0. (default: 0) (Optional) |
Example |
new Date() new Date (2006, 9, 25, 15, 30) |
Class
Date UTC (year:
number[, month:
number=0][, day:
number=0][, hours:
number=0][, min:
number=0][, sec:
number=0][, ms:
number=0])
Returns the number of milliseconds between midnight January 1, 1970, UTC, and the specified time.
Parameter | Type | Description |
---|---|---|
year | number | The year expressed in four digits, for example, 2001. To indicate for a year from 1900 to 1999, you can specify a value from 0 to 99. |
month | number (range: 0 - 11) | An integer value from 0 (Jan) to 11 (Dec). (default: 0) (Optional) |
day | number (range: 1 - 31) | An integer value from 1 to 31, If this argument is not supplied, its value is set to 0. (default: 0) (Optional) |
hours | number (range: 0 - 23) | An integer value from 0 (midnight) to 23 (11 PM). If this argument is not supplied, its value is set to 0. (default: 0) (Optional) |
min | number (range: 0 - 59) | An integer value from 0 to 59. If this argument is not supplied, its value is set to 0. (default: 0) (Optional) |
sec | number (range: 0 - 59) | An Integer value from 0 to 59. If this argument is not supplied, its value is set to 0. (default: 0) (Optional) |
ms | number (range: 0 - 999) | An integer value from 0 to 999. If this argument is not supplied, its value is set to 0. (default: 0) (Optional) |
Example | Date.UTC(year , month, date, hour, min, sec, ms) |
Date parse (text:
string)
Parses a string, returning a new Date object. The string should be similar to the string returned bt toString().
Parameter | Type | Description |
---|---|---|
text | string | The string to parse. |
Instances
number getDate ()
Returns the day of the month of the specified Date object in local time. Range: 1 - 31
Example | date.getDate() |
number getDay ()
Returns the day of the week for the specified Date object in local time.
This is an integer from 0 (Sunday) to 6 (Saturday). Returns the day of the week for date. Range: 0 - 6
Example | date.getDay() |
number getFullYear ()
Returns the four digit year of the specified Date object in local time.
Example | date.getFullYear() |
number getHours ()
Returns the hour of the specified Date object in local time. Range: 0 - 23
Example | date.getHours() |
number getMilliseconds ()
Returns the milliseconds of the specified Date object in local time. Range: 0 - 999
Example | date.getMilliseconds() |
number getMinutes ()
Returns the minutes of the specified Date object in local time. Range: 0 - 59
Example | date.getMinutes() |
number getMonth ()
Returns the month of the specified Date object in local time. Range: 0 - 11
Example | date.getMonth() |
number getSeconds ()
Returns the seconds of the specified Date object in local time. Range: 0 - 59
Example | date.getSeconds() |
number getTime ()
Returns the number of milliseconds since midnight January 1,1970 UTC for the specified Date object.
Example | date.getTime() |
number getTimezoneOffset ()
Returns the difference in minutes between the computer's local time and UTC.
Example | date.getTimezoneOffset() |
number getUTCDate ()
Returns the day of the month of the specified Date object according to UTC. Range: 1 - 31
Example | date.getUTCDate() |
number getUTCDay ()
Returns the day of the week for the specified Date object according to UTC. Range: 0 - 6
Example | date.getUTCDay() |
number getUTCFullYear ()
Returns the four digit year of the specified Date object according to UTC.
Example | date.getUTCFullYear() |
number getUTCHours ()
Returns the hour of the specified Date object according to UTC. Range: 0 - 23
Example | date.getUTCHours() |
number getUTCMilliseconds ()
Returns the milliseconds of the specified Date object according to UTC. Range: 0 - 999
Example | date.getUTCMilliseconds() |
number getUTCMinutes ()
Returns the minutes of the specified Date object according to UTC. Range: 0 - 59
Example | date.getUTCMinutes() |
number getUTCMonth ()
Returns the month of the specified Date object according to UTC. Range: 0 - 11
Example | date.getUTCMonth() |
number getUTCSeconds ()
Returns the seconds of the specified Date object according to UTC. Range: 0 - 59
Example | date.getUTCSeconds() |
number getYear ()
Returns the year of the specified Date object, as a difference from 1900, in local time.
Example | date.getYear() |
number setDate (date:
number)
Sets the day of the month of a specified Date object according to local time.
Returns the number of milliseconds between the new date and midnight, January 1, 1970.
Parameter | Type | Description |
---|---|---|
date | number (range: 1 - 31) | An integer from 1 to 31 indicating the day of the month. |
Example | date.setDate(date) |
number setFullYear (year:
number)
Sets the year of a specified Date object according to local time.
This method can also set month and date if those arguments are specified. Returns the number of milliseconds between the new date and midnight, January 1, 1970.
Parameter | Type | Description |
---|---|---|
year | number | A four-digit integer value indicating the year to set. |
Example | date.setFullYear(year, month, date) |
number setHours (hour:
number)
Sets the hours of a specified Date object according to local time.
Returns the number of milliseconds between the new date and midnight, January 1, 1970.
Parameter | Type | Description |
---|---|---|
hour | number (range: 0 - 23) | An integer value from 0 (midnight) to 23 (11 PM). |
Example | date.setHours(hour) |
number setMilliseconds (ms:
number)
Sets the milliseconds of a specified Date object according to local time.
Returns the number of milliseconds between the new date and midnight, January 1, 1970.
Parameter | Type | Description |
---|---|---|
ms | number (range: 0 - 999) | An integer value from 0 to 999. |
Example | date.setMilliseconds(ms) |
number setMinutes (minutes:
number)
Sets the minutes of a specified Date object according to local time.
Returns the number of milliseconds between the new date and midnight, January 1, 1970.
Parameter | Type | Description |
---|---|---|
minutes | number (range: 0 - 59) | An integer value from 0 to 59. |
Example | date.setMinutes(minutes) |
number setMonth (month:
number)
Sets the month of a specified Date object according to local time.
Returns the number of milliseconds between the new date and midnight, January 1, 1970.
Parameter | Type | Description |
---|---|---|
month | number (range: 0 - 11) | An integer value from 0 (Jan) to 11 (Dec). |
Example | date.setMonth(month) |
number setSeconds (seconds:
number)
Sets the seconds of a specified Date object according to local time.
Returns the number of milliseconds between the new date and midnight, January 1, 1970.
Parameter | Type | Description |
---|---|---|
seconds | number (range: 0 - 59) | An integer value from 0 to 59. |
Example | date.setSeconds(seconds) |
number setTime (ms:
number)
Sets the date of a specified Date object in milliseconds since midnight, January 1, 1970.
Returns the value of ms.
Parameter | Type | Description |
---|---|---|
ms | number | An integer indicating the number of milliseconds between the date set and midnight, January 1, 1970. |
Example | date.setTime(ms) |
number setUTCDate (date:
number)
Sets the date of a specified Date object according to universal time.
Returns the number of milliseconds between the new date and midnight, January 1, 1970 in UTC time.
Parameter | Type | Description |
---|---|---|
date | number (range: 1 - 31) | An integer from 1 to 31 indicating the day of the month. |
Example | date.setUTCDate(date) |
number setUTCFullYear (year:
number)
Sets the year of a specified Date object according to UTC, can also set the month and date.
Returns the number of milliseconds between the date set and midnight, January 1, 1970, in UTC.
Parameter | Type | Description |
---|---|---|
year | number | The year expressed in four digits. |
Example | date.setUTCFullYear(year, month, date) |
number setUTCHours (hours:
number)
Sets the hours of a specified Date object according to UTC.
Returns the number of milliseconds between the date set and midnight, January 1, 1970, in UTC.
Parameter | Type | Description |
---|---|---|
hours | number (range: 0 - 23) | An integer value from 0 (midnight) to 23 (11 PM) indicating the hour to be set. |
Example | date.setUTCHours(hours) |
number setUTCMilliseconds (ms:
number)
Sets the milliseconds of a specified Date object according to UTC.
Returns the number of milliseconds between the date set and midnight, January 1, 1970, in UTC.
Parameter | Type | Description |
---|---|---|
ms | number (range: 0 - 999) | An integer value in the range of 0 to 999 indicating the number of milliseconds to set. |
Example | date.setUTCMilliseconds(ms) |
number setUTCMinutes (min:
number)
Sets the minutes of a specified Date object according to UTC.
Returns the number of milliseconds between the date set and midnight, January 1, 1970, in UTC.
Parameter | Type | Description |
---|---|---|
min | number (range: 0 - 59) | An integer value in the range 0 to 59 indicating the number of minutes to be set. |
Example | date.setUTCMinutes(min) |
number setUTCMonth (month:
number)
Sets the month of a specified Date object according to UTC.
Returns the number of milliseconds between the date set and midnight, January 1, 1970, in UTC.
Parameter | Type | Description |
---|---|---|
month | number (range: 0 - 11) | An integer value in the range 0 (Jan.) to 11 (Dec.) indicating the month to set. |
Example | date.setUTCMonth(month) |
number setUTCSeconds (sec:
number)
Sets the seconds of a specified Date object according to UTC.
Returns the number of milliseconds between the date set and midnight, January 1, 1970, in UTC.
Parameter | Type | Description |
---|---|---|
sec | number (range: 0 - 59) | An integer value in the range 0 to 59 indicating the number of seconds to set. |
Example | date.setUTCSeconds(sec) |
number setYear (year:
number)
Sets the year of a specified Date object according to local time, as a difference between the current year and 1900.
Returns the number of milliseconds between the date set and midnight, January 1, 1970.
Parameter | Type | Description |
---|---|---|
year | number | An integer value indicating the year to set. The method interprets a 1- or 2- digit value to mean the 1900s; for example, 13 is interpreted to mean 1913. |
Example | date.setYear(year, month, date) |
string toDateString () Returns the date as a string.
string toGMTString () Returns the date and time adjusted to GMT (UTC) as a string.
string toLocaleDateString () Returns the date as a localized string.
string toLocaleString () Returns a string value representing the date and time stored in the Date object in human readable format (localized).
string toLocaleTimeString () Returns the time as a localized string.
string toSource ()
Creates a string representation of this object that can be fed back to eval() to re-create an object. Works only with built-in classes.
string toString ()
Returns a string value representing the date and time stored in the Date object in human readable format.
Returns the following string is an example of the format returned by this method: Mon Aug 13, 10:54:21 GMT-0700 2001.
Example | date.toString() |
string toTimeString () Returns the time as a string.
string toUTCString () Returns the date and time adjusted to UTC as a string.
number valueOf ()
The valueOf() method returns the number of milliseconds that have passed since midnight, Returns an integer.
Element of
$.buildDate
Asset.date
BookContent.date
Change.date
DocumentEvent.timeStamp
Event.timeStamp
Event.timeStamp
File.created
File.modified
Folder.created
Folder.modified
IdleEvent.timeStamp
ImportExportEvent.timeStamp
Link.date
LinkMetadata.creationDate
LinkMetadata.modificationDate
MetadataPreference.creationDate
MetadataPreference.modificationDate
MutationEvent.timeStamp
Note.creationDate
Note.modificationDate
PrintEvent.timeStamp
UIEvent.timeStamp
Return
Date Date.Date (year: number[, month: number=0][, day: number=0][, hours: number=0][, min: number=0][, sec: number=0][, ms: number=0])
Date Date.UTC (year: number[, month: number=0][, day: number=0][, hours: number=0][, min: number=0][, sec: number=0][, ms: number=0])
Date Date.parse (text: string)
Jongware, 20-Jun-2010 v3.0.3d | Contents :: Index |