Time Zone Troubles? Fix it with Jinja in Quickbase Pipelines
Jun 09, 2021>> Get the Jinja Date & Time Cheat Sheet <<
This demo predates the new Pipeline Designer. For writing Jinja, the process is similar, but you'll need to click on the </> code icon first. To follow along in the old designer, toggle OFF the "Pipeline Designer" at the top of the screen.
Accessing the current date/time in Pipelines using Jinja can be SUPER helpful, but if you don't convert it to your local time zone... it can be SUPER frustrating.
When using the {{ time.now }} Jinja template, you may not immediately notice that you have a time zone issue.
For me on Pacific Time, I'm currently 7 hours behind the UTC time that this template returns... so it's only after 5 PM that I start having issues (when referencing just the date).
Basically, any pipeline running after 5 PM time will use the next day's values 😱
This is a problem. (read more about it)
We can fix this with the Jinja timezone filter.
Apply Time Zones, such as:
- Eastern
- Central
- Mountain
- Pacific
- Plus many more!
How to use the Jinja timezone filter
To add the timezone filter to your {{ time.now }} templates you'll include a "pipe" symbol followed by the 'timezone' function and then the properly formatted time zone within a set of parentheses and single quotations.
Here are several common examples:
Eastern
{{ time.now|timezone('America/New_York') }}
Central
{{ time.now|timezone('America/Chicago') }}
Mountain
{{ time.now|timezone('America/Denver') }}
Pacific
{{ time.now|timezone('America/Los_Angeles') }}
For more time zones use the "TZ database names "column on this Wikipedia page.
What's even better, most of these time zones adjust for daylight savings too!
For more information on Jinja see the resources below, or skip right to the good stuff and get the Intro to Jinja for Pipelines course today!
RESOURCES:
Get the FREE Jinja Date & Time Cheat Sheet mentioned in this video
Lookup additional Time Zones
Learn more about how Jinja works in Pipelines
Adjust dates & times using Jinja
Feeling like a Junkie? Subscribe Now!