(dateString: string): date
(unixTimestamp: number): date
The _date
operator returns a date object representing a single moment in time. It can take a string in ISO 8601 format, or a number that is the number of milliseconds since 1 January 1970 UTC (the UNIX epoch).
Arguments
string
An string in ISO 8601 format representing a date and time.
number
The number of milliseconds since 1 January 1970 UTC.
Examples
Timestamp:
_date: 1611837509802
Returns: Thu Jan 28 2021 12:38:29 GMT+0000
ISO 8601 string, only date:
_date: 2021-01-28
Returns: Thu Jan 28 2021 00:00:00 GMT+0000
ISO 8601 string, date and time:
_date: 2021-01-28T12:36:03.957Z
Returns: Thu Jan 28 2021 12:38:29 GMT+0000
Operator methods:
_date.now
(void): date
The _date.now
method returns a date object representing the moment in time it was called. The method can also be used as _date: now
Arguments
The _date.now
method does not take any arguments.
Examples
Get the current date and time:
_date.now: null
_date: now
Returns: The current date and time.