I’ve got a database, which stores UTC timestamps, from which I need to create reports for user-selected time ranges. Naturally, the users are not thrilled about having to convert times to UTC in their head.
Is there a way to insert user’s timezone into SQL query? (Can’t hardcode it, because not all users are in the same timezone).
jesse
April 29, 2020, 8:02pm
2
Welcome to the forum! Please search the forum before posting new questions. We answered this exact question not long ago.
I don’t think you need to change anything about how RDS treats the dates internally. You just need to write your query so that the TZ info is returned with the timestamps.
If your timestamp comes through as 2020-01-28T20:09:00 Redash assumes it’s UTC and displays it unchanged.
If your timestamp comes through as 2020-01-28T20:09:00-0800 then Redash knows it’s offset by UTC-8. Redash converts it to UTC for display in Redash’s UI.
For example, when it was 8:09PM on January 28th in California it …
No.
Dates and times are passed to the database as-is. If the database stores them as UTC then your users need to enter them in UTC.
1 Like
We answered this exact question not long ago.
I wouldn’t say “exact”. I am not expecting Redash to perform time conversion, just to tell me what the user’s time zone is.
So it sounds like what I need just isn’t possible with Redash?
jesse
April 30, 2020, 12:33pm
4
Vadim17:
I wouldn’t say “exact”.
Fair point.
Yes.
Like I mentioned in the linked post, it’s on our roadmap to add timezone offset by user which would make your use-case possible.