Date

(esrith/amos/core/Date)

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")

Constructors Detail
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").

Parameters:
  • <String> dateString Required

    String of date, time or datetime. It depends on the date format.

new Date(dateStringdateFormat)

Create a new Date object with date string and date format.

Parameters:
  • <String> dateString Required

    String of date, time or datetime. It depends on the date format.

  • <String> dateFormat Required

    String of date format.

new Date(milliseconds)

Create a new Date object with milliseconds.

Parameters:
  • <Number> milliseconds Required

    Number of milliseconds. If this parameter is 0, the date object will be return "Jan 01 1970".

Methods Detail
<Number>
compare
(
  • otherDate
)

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.

Parameters
  • <Date> otherDate Required

    other date which you want to compare

<Number>
getTime
()

Convert datetime to milliseconds.

<Number>
toAGSDate
()

Convert datetime to milliseconds(timezone offset included).

<String>
toString
(
  • format?
)

Converts the value of the current DateTime object to its equivalent string representation using the specified format. (default: "dd/MM/yyyy HH:mm:ss")

Parameters
  • <String> format Optional

    format for date