Hi. Our Good Data environment is connected to a po...
# gooddata-cloud
a
Hi. Our Good Data environment is connected to a postgresql db and the timestamps in all the date columns are in UTC, e.g.
2024-11-13 20:41:12.254608
. When these are displayed in the visualizations, they are showing up as that time in the timezone that is selected without the proper offset applied, e.g. 8:41 PM instead of 2:41 PM (for US central time for example). How do I fix this? Thanks.
m
Hi Adam, if I understand the issue correctly, you would like to display the 24hr clock as represented in your data - You can do this by updating your “Date format” settings under the “Home” page and then going to “Settings” and from there you can see the option and timezone:
Please note: To change the date format for individual workspaces or users, you’ll need to use our API: https://www.gooddata.com/docs/cloud/customize-appearance/manage-timezones/
a
@Michael Ullock No. I want it to show in US central time in this case since that is what the timezone is set to in good data settings, i.e. show 2:41 PM ...not 8:41 PM like it is showing now
In other words, it should be converting the UTC time in the db to US central time, and it is not currently.
It is currently converting it without the -6 hour offset, and it should be applying that offset
m
Thanks for the clarification 🙂 Please let our team review this and get back to you with more details on this asap
1
Hi Adam, may I ask if you have reviewed our TimeZone documentation? As mentioned in our documentation here: https://www.gooddata.com/docs/cloud/customize-appearance/manage-timezones/ If your data is stored in the
DATE
or
TIMESTAMP
data types, no time conversion is available.
We recommend configuring the time zone for the organization or workspace, so that you always see relevant data.
If the data in your database has a time zone specified in the
TIMESTAMPTZ
data type, the data converts to the time zone of individual users based on their settings. More details can be found in the above documentation
a
Yes. It doesn't seem too relevant since I set the timezone in settings to US central time already (see attached screenshot) and right now I don't need to set it on an org, workspace, or user level since I am just trying to get it to show properly at all. I see how it mentions "If your data is stored in the
DATE
or
TIMESTAMP
data types, no time conversion is available" but I have no idea how to see what data type you are storing it as. I just dragged in a date in the LDM and it doesn't say what type it auto picks (see screenshots for example).
m
Hi Adam, I have quickly tested this and it is working as expected for me, I made sure to declare the timestamps as "TIMESTAMPTZ" datatype. Please check the screenshot below for the results. You will notice how there is an offset of -8 hours (though my server displays the timestamps in my current timezone, CEST, hence the "+1" in the query results).
Note that you will not be able to check the datatype for your timestamps directly from GoodData Cloud, you will need to do this from your database. If they are not showing as "TIMESTAMPTZ", you will need to convert them in your database so the timezone conversion works properly in your workspace.
One more thing to take into account is that the timezone settings applied at the workspace level overrides any timezone setting applied directly from the general settings page. I recommend checking the workspace settings as well, in case the offset is still not applied properly. For this you can do a GET to the following endpoint:
Copy code
$HOST_URL/api/v1/entities/workspaces/$WORKSPACE_ID/workspaceSettings/
a
@Moises Morales Okay I confirmed that there are no workspace level timezone settings. I also found out that our postgres datatype for date+time columns are
timestamp
...so I casted them to
timezonetz
using your SQL dataset feature in the LDM like this for example:
select "completed_at"::timestamptz at time zone 'Etc/UTC' AS completed_at
However, when I do that, there is no longer an option in the visualization builder to pick Hour or Minute (see screenshot). Why would that be? I see times there when I run it in the SQL dataset UI (see screenshot). Also, when I change the timezone in the select to 'America/Chicago' or something then the times change when I click run, so I'm pretty sure my casting is working properly.
Also, when I check the data mapping tab, I see it is mapped as a TIMESTAMP_TZ now in your UI so that looks correct too
m
Thanks for trying that. In this case there seems to be a limitation as to what the CAST command can actually do, there are some known cases especially when working with PostgreSQL, in other words, the CAST will not work as intended for the timestamp datatype conversion. Are you having any troubles declaring your timestamp as "timezonetz"? You could try it from a view to test quickly.
a
Oh I figured out why hour and minute weren't showing, these weren't checked by default when I dragged in the new date into the LDM. Looks like there might be an AM/PM issue now though. Stand by.
@Moises Morales I see what it's doing now. I have the timezone in GoodData settings set to US Central Time and it is offsetting it 6 hours forward rather than 6 hours backward. When I change it to US Pacific Time then it offsets it 8 hours forward rather than 8 hours backward. Is this a bug or am I missing something?
Then when I set it to Almaty time zone it offsets it 6 hours backward rather than forward. Weird
Got it. For whatever reason if I change the SQL dataset to use the following instead, then the offset will get applied in the proper direction.
select "completed_at"::timestamp at time zone 'UTC' AS completed_at
@Moises Morales Now that I have this working, I'd like to put in a feature request that would help us with our 100% embedded via iframe implementation: it would be great if we could set the timezone via a url param like you do for these other settings: https://www.gooddata.com/docs/cloud/embed-visualizations/iframes/embed-dashboard-via-iframe/#EmbedDashboardsUsingIframes-ConfigurationOptions ...or some other way to set it on an embed by embed basis. We needed to have a one user per workspace setup for various reasons, so currently both your workspace level timezone and your user level timezone setting does the same thing for us so for any of our customers that have people across multiple timezones, they are currently going to have to live with a single timezone setting for their entire org, which is not ideal.
m
I am glad to hear it is now working! I am not sure if I follow, I do agree that setting the timezone via the URL paramenter of an embedded dashboard would be handy in any case, nonetheless setting the timezone for individual users or workspaces within an organization is possible via the API: https://www.gooddata.com/docs/cloud/customize-appearance/manage-timezones/#ManageTimeZones-Users
Let me know if it helps, otherwise we will be glad to submit product feedback on your behalf.
a
Yes I saw how to set time zone via the API at the workspace or user level and I am currently using it at the workspace level, which gets us at least some of the way there. The issue is that with our 100% embedded implementation, we only have one good data user per workspace (i.e. workspace = one of our enterprise customers with many users). In other words, we cannot have one good data user per user on our platform for technical reasons that would take too long to explain in a message. Thus, the feature request is to be able to set the time zone at the time of the embed. This would be the only way to allow our users who are in a workspace/enterprise see the proper time zone if they do not happen to be in the time zone I set for the workspace...which is often the case since many of our customers have employees around the country/world. Please go ahead and submit the feature request. Thanks Moises.
p
🎉 New note created.
m
Thanks for the details! I have shared this internally with our developers so it gets considered for future Product releases. Please note that I cannot promise it will ever be implemented, but depending on how critical this is for you, I strongly recommend discussing it with your Account Manager @Pavel Doubek as well
1
a
Understood. Thanks