Date Functions
The default date format is dates in UTC timezone in RFC3339 format.
Example:
Date Arithmetic
To add and subtract time interval from another time use + and -
Supported intervals:
Day, Month and Year are not supported because they have variable lengths.
Now | NowUnix | NowUnixMili
Function | Description |
---|---|
now() | Returns the current time in timestamp format. Example output: 2022-07-28T15:02:26Z |
now_unix() | Returns the elapsed epoch current time. Example output: 1659020794 |
now_unix_mili() | Returns the elapsed epoch milliseconds current time. Example output: 1659020794000 |
To Date
Use to_date
to transform date string representation or date represented as Epoch time (seconds since 1970-01-01) into date. This enables performing date operations on the date such as +/-.
To Epoch
Transforms the date string into Epoch time (seconds since 1970-01-01). Also works with input which is already an Epoch, in which case it returns the input as is.
To Epoch Mili
Transforms the date string into Epoch Milliseconds time (seconds since 1970-01-01). Also works with input which is already an Epoch Milliseconds, in which case it returns the input as is.
To Local Time
Format the date as local time in a given time zone. Accepts dates as Epoch time or string in RFC3339 format.
Date Format
Format the date in user requested format. Inputs are:
- Layout in Golang date format convention.
- Input date in RFC3339 format or as an Epoch time (seconds since 1970-01-01).
Was this page helpful?