Class for date and time. This class can compare two Date instances. It can also convert to Date object to string.
Description | ||
new Date() |
Create a new Date object with current date. |
|
new Date(dateString) |
Create a new Date object with date string (format: "dd/MM/yyyy"). |
|
new Date(dateStringdateFormat) |
Create a new Date object with date string and date format. |
|
new Date(milliseconds) |
Create a new Date object with milliseconds. |
Return type | Description | |
compare(otherDate) | Number |
Compares two instances of DateTime and returns an integer that indicates whether the first instance is earlier than, the same as, or later than the second instance. |
getTime() | Number |
Convert datetime to milliseconds. |
toAGSDate() | Number |
Convert datetime to milliseconds(timezone offset included). |
toString(format?) | String |
Converts the value of the current DateTime object to its equivalent string representation using the specified format. (default: "dd/MM/yyyy HH:mm:ss") |
Create a new Date object with current date.
Create a new Date object with date string (format: "dd/MM/yyyy").
<String>
dateString
|
Required |
String of date, time or datetime. It depends on the date format. |
Create a new Date object with date string and date format.
Create a new Date object with milliseconds.
<Number>
milliseconds
|
Required |
Number of milliseconds. If this parameter is 0, the date object will be return "Jan 01 1970". |