Wrapper around the momentjs library to easily generate and format dates. Defaults to current timestamp (UTC). Please refer to momentjs documentation for more information about formatting options.
- action: for now, can only be "format"
- date: the date you want to format (defaults to current time)
- unix: if set to
true
, returns the number of seconds since epoch - unix_ms: if set to
true
, returns the number of milliseconds since epoch - ISO: if set to
true
, returns the date formatted in ISO8601 format ("2013-02-04T22:44:30.652Z"
) - format: the format you want to apply to the date
Note: only one of unix, unix_ms, ISO or format can be set. These options will be evaluated in that order.
Usage
App("utils/datetime", action="format", date="12/03/2014 13:37", format="YYYYMMDD")