Date/Time Tricks

Timestamps

Using now() gives you a timestamp in seconds.

We then want to pipe that to to_human_time_from_seconds so we can then convert to our preferred timezone and then finally, format how we want.

## Get Current Date

{{ now() | to_human_time_from_seconds | as_timezone('<tz here>') | format_datetime("%Y-%m-%dT%H:%M:%S") }}

Get Current Year

{{ now() | to_human_time_from_seconds | as_timezone('<tz here>') | format_datetime("%Y") }}

Get Current Month

{{ now() | to_human_time_from_seconds | as_timezone('tz_here') | format_datetime("%m") }}

Last updated