Working with time zones in the retool db

Timezones? :unamused_face:

My goal: Fetch and display, consistently, dates and timestamps stored in Retool db

Issue: where is ā€œmanage time zonesā€? screen-snap would be GREAT. Gonna be a face palm, I can feel it coming, but dang if we can find the manage-timezone-toggle.

This page [ Getting started with date and time components | Retool Docs ] mentions:

Components that display date time values support time zone offsets. When configured, the component displays a date time value (displayValue) to the user based on the selected offset without altering value itself. Similarly, when a user selects a different date time value, this changes the displayValue. Retool uses the same offset to calculate the actual value to use.

To manage time zones on these components, toggle Manage time zone in the Inspect tab of the right panel. The demo app below shows the difference in how date and time values appear when using managed and unmanaged time zones. Each component has the same underlying value.

The ā€œInspectā€ flyout is rather obvious... But where is the toggle ā€œManage Time Zoneā€ in ā€œthe inspect tab of the right panel?ā€

Steps I've taken to troubleshoot: searching retool forums, searching google, searching youtube, looking for any screenshot to show where ā€œmanage time zoneā€ might be. The table-component doesn’t seem to have any time-zone features in ā€œinspectā€ and the timestamp column itself, doesn’t either.

When we insert a new record, or update an existing one, in the native Retool postgres db, we use ā€œcurrent_timestampā€. Then when we bring that idata nto a Retool component for display, sometimes it’s timezone-shifted implying UTC-to-CDT conversion, sometimes it’s not. We are hoping that the ā€œmanage time zoneā€ feature might help.

As a workaround, we can change the display-type to ā€œTextā€ and then use javascript mapping to display things in the time zone we want. But it’d be more integrated if we could use a Retool-savvy feature instead!

Additional info: Cloud hosted, enterprise

Hey @trillich ,

I think this is what you’re looking for! This is the inspector view for the Date Time component, are you using a different component than that?

1 Like

@mitchel_smith Aha, that’s …interesting. So, for a datetime INPUT, I can see placeholder and manage-time-zone. It’s cool how you can use FX to determine the data that flows thru that component.

What we were hoping for, is time-zone handling for a dateteime COLUMN inside a TABLE. That is, we have SQL that does a SELECT which includes a datetime field, and then we display that inside a table component in the user interface.

There’s already a default in place to display datetimes within a table component column, but it’s not obvious how we can control that.

It’s looking more and more like we found the right solution by treating the column as ā€œTextā€ (instead of ā€œDatetimeā€) and then having javascript mapping convert timezones as needed.

Hey @trillich,

Also possible on a Datetime column inside a table! Same selector, but further down the page. You’ll want to make sure that you’ve selected Datetime or time as your format.

Awesome! Face-palm, toldja! It was there all along…

Thanks!

1 Like