# DATETIME formatting

DATETIME(timestamp, format, output timezone) is a Conducttr function used to make dates and times look attractive.

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

## Formats

Below are the date-time formatting specifications.<br>

<table data-header-hidden><thead><tr><th width="186"></th><th></th></tr></thead><tbody><tr><td>Format<br></td><td>Description<br></td></tr><tr><td><em>W</em><br></td><td>number of the week in the year (Monday is the first day of the week) with leading zero, 00-53<br></td></tr><tr><td><em>w</em><br></td><td>number of the week in the year (Sunday is the first day of the week) with leading zero, 00-53<br></td></tr><tr><td><em>yy</em> or <em>YY</em><br></td><td>2-digit year, e.g. 16<br></td></tr><tr><td><em>yyyy</em> or <em>YYYY</em><br></td><td>4-digit year, e.g. 2016<br></td></tr><tr><td><em>M</em><br></td><td>number of the month without leading zero, e.g. 1<br></td></tr><tr><td><em>MM</em><br></td><td>number of the month with leading zero, e.g. 01<br></td></tr><tr><td><em>MMM</em><br></td><td>abbreviated month name, e.g. Jan<br></td></tr><tr><td><em>MMMM</em><br></td><td>full month name, e.g. January<br></td></tr><tr><td><em>d</em> or <em>D</em><br></td><td>day of the month without leading zero, e.g. 1<br></td></tr><tr><td><em>dd</em> or <em>DD</em><br></td><td>day of the month with leading zero, e.g. 01<br></td></tr><tr><td><em>ddd</em><br></td><td>abbreviated name of the day of the week, e.g. Sun<br></td></tr><tr><td><em>dddd</em><br></td><td>full name of the day of the week, e.g. Sunday<br></td></tr><tr><td><em>h</em><br></td><td>hours (12-hr format) without leading zero<br></td></tr><tr><td><em>hh</em><br></td><td>hours (12-hr format) with leading zero<br></td></tr><tr><td><em>H</em><br></td><td>hours (24-hr format) without leading zero<br></td></tr><tr><td><em>HH</em><br></td><td>hours (24-hr format) with leading zero<br></td></tr><tr><td><em>mm</em><br></td><td>minutes<br></td></tr><tr><td><em>ss</em><br></td><td>seconds<br></td></tr><tr><td><em>SSSSSS</em><br></td><td>microseconds with leading zeros, 000000-999999<br></td></tr><tr><td><em>p</em> or <em>tt</em><br></td><td>AM/PM label<br></td></tr><tr><td><em>z</em> or <em>Z</em> or <em>TZD</em><br></td><td>time zone label, e.g. UTC<br></td></tr><tr><td><em>zz</em> or <em>ZZ</em><br></td><td>time zone offset without colon, e.g. +0100<br></td></tr><tr><td><em>zzz</em> or <em>ZZZ</em><br></td><td>time zone offset with colon, e.g. +01:00<br></td></tr></tbody></table>

***

## Examples

The content body  might look like:\
\&#xNAN;*"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”)|."*<br>

The example above shows the full-blown version with all the optional function parameters. The short one would look like: \
\&#xNAN;*"You started at |datetime(audience.start\_time)| and finished at |datetime(audience.end\_time)|."*<br>

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).<br>

Other examples are\
|datetime(audience.end\_time, “HH:mm:ss Z (ZZ)”, audience.timezone)|\
Example result: “04:05:00 PST (-0800)”<br>

|datetime(audience.end\_time, “d/M/yyyy, ZZ, HH:mm:ss”, audience.timezone)|\
Example result: “1/1/2015, -0800, 04:05:00”<br>

&#x20;|datetime(audience.end\_time, “HH:mm:ss Z (ZZ)”, audience.timezone)|\
Let’s say the audience.end\_time is “2015-06-01 12:05:00” instead of “2015-01-01 12:05:00”\
Example result: “05:05:00 PDT (-0700)”\
\
tz\_timezones\
A list of tz\_timezones can be found here <https://en.wikipedia.org/wiki/List_of_tz_database_time_zones>
