Is it possible to convert scheduledAt from UTC to another timezone using liquid?

I am creating a Flow that is scheduled to send an email and I would like the scheduledAt datetime to be shown in my timezone.

Printing the date without the timezone works:

{{scheduledAt | date: "%Y-%m-%d %H:%M %Z"}}

I tried this but it didn’t work:

{{scheduledAt | in_time_zone: 'America/Los_Angeles' | date: "%Y-%m-%d %H:%M %Z"}}

Error:

Liquid syntax error: Unexpected character in “{{scheduledAt | in_time_zone: ‘America/Los_Angeles’ | date: “%Y-%m-%d %H:%M %Z”}}”

I saw a few other questions asking similar questions about printing out the current datetime and the answer was to use Javascript, but I don’t think that will work in an email for a specific datetime variable.

Is it possible to print the datetime such from scheduledAt in a specific timezone other than UTC in a Flow workflow generated email?

1 Like

Here’s a workaround to adjust the hours manually—not ideal but it 'll work in a pinch:

{{scheduledAt | date: '%s' | minus: 25200 | date: '%A, %B %e, %Y at %l:%M%P'}} PDT

﹡ “minus: 25200” is 7 hours in seconds because I wanted Pacific Time and it’s currently 7 hours behind UTC.

2 Likes