Formats the output of a given time stamp and/or converts it into a different time zone.
The parameters are DATETIME(timestamp, format, output timezone)
- timestamp = input; required, uses the format “yyyy-mm-dd hh:mm:ss”
- format = output format, e.g. ‘HH:mm:ss’ (see details)
- output timezone = timezone for output; optional, defaults to project’s time zone (currently defaults to project owner’s time zone)
The content body (e.g. an outgoing sms) might look like:
"You started at |datetime(audience.start_time, “HH:mm:ss”, “America/New_York”)| and finished at |datetime(audience.end_time, “HH:mm:ss”, “America/New_York”)|."
The example above shows the full-blown version with all the optional function parameters. The short one would look like:
"You started at |datetime(audience.start_time)| and finished at |datetime(audience.end_time)|."
The second function parameter specifies the date/time format, and the 3rd one specifies the time zone to use. The time zone can be specified in 2 formats - 'America/New_York' (this is a universally-accepted representation for US Eastern Time).
Other examples are
Below are the date-time formatting specifications.
number of the week in the year (Monday is the first day of the week) with leading zero, 00-53
number of the week in the year (Sunday is the first day of the week) with leading zero, 00-53
yy or YY
2-digit year, e.g. 16
yyyy or YYYY
4-digit year, e.g. 2016
number of the month without leading zero, e.g. 1
number of the month with leading zero, e.g. 01
abbreviated month name, e.g. Jan
full month name, e.g. January
d or D
day of the month without leading zero, e.g. 1
dd or DD
day of the month with leading zero, e.g. 01
abbreviated name of the day of the week, e.g. Sun
full name of the day of the week, e.g. Sunday
hours (12-hr format) without leading zero
hours (12-hr format) with leading zero
hours (24-hr format) without leading zero
hours (24-hr format) with leading zero
microseconds with leading zeros, 000000-999999
p or tt
z or Z or TZD
time zone label, e.g. UTC
zz or ZZ
time zone offset without colon, e.g. +0100
zzz or ZZZ
time zone offset with colon, e.g. +01:00