I have read a number of post about capturing a user’s Local time in the data sheet.
But I have a realy basic issue - I wan’t to store in the data sheet a single timezone (UTC), and to use the user’s phone or computer’s Local Time setting to display that date and time in the User’s Local time zone - pretty basic, I should think - but why can’t Glide apps cope with this.
The column in the data sheet is formated like this 2022-07-25T02:55:00.0000Z, but it displays the date/time in UTC regardless of the users device settings.
Thanks, Jeff for your email. All of the topics in the discussion board, (and I have read many before now) are about converting a user input which is in UTC time-zone in the data sheet. I don’t want to convert UTC in the data sheet = it is already in this format in the datasheet - what I want it to do is display the correct local date/time on the app in the users time zone.
It is really difficult to find the answer to this on any of the Glide Help docs, - but your solution; of adding GMT to the UTC time works. I did have to change the date format to text
as “MM/DD/YYYY, hh:mm:ss GMT” - but whow! it works.
Thanks for your help!
Here is a picture of the app
and here is a link to the app - as I say it is read-only and open to anyone without sign-in - So it shoud be in your time-zone where ever you are!.
Jeff – absolutely – I’ve been trying to figure this out for the last 18 months.
Thanks so much for you help on this.
My next big task, is to localize the TV channels –
Cheers
Anthony Kelly
68 Castleview Road, Clondalkin, Dublin 22, D22 YY42
M: +353 87 295 8667
@Jeff_Hager @Anthony_Kelly → could you please enlighten me of the process: I do to have a time in google sheets stored as UTC (i.e. 2024-08-18T09:00Z) and even after reading this and the corresponding post, I’m not quite sure how to get this conversion to a local time - do I need to create additional columns in Glide with the math calc? Or is just enough to simply present (convert the UTC to the format as “MM/DD/YYY hh:mm:ss GMT” and it will automatically show the correct local time?
This is a pretty old post. I think there are better ways now. I’m not near a computer at the moment to fully test, but you should be able to use a Format Date column to get your timezone offset.
Then use Math column to divide it by 24 to get a decimal representation of hours, as well as add that result to your date with another math column.
Date + (Offset/24)
If it works, you should end up with a date converted from UTC time to your local time.
@Jeff_Hager – thanks for the quick reply! I dug deeper and based on the experimental field with plugins (Format Date column | Glide) I was able to just add the column (see screenshot) and reference the column with UTC date/time - and it looks like it works fine (I changed my system timezone to test it in MT and PT )
… Bummer… – I spoke too soon
Column: DateUTC (text) with value: “2024-08-21T17:00Z” should return noon (I’m CDT) - but I’m getting Wednesday, August 21, 2024 at 10:00PM" (when double click on the value it shows: “2024-08-21T22:00:00.000Z”)
My offset time is -5hrs but the system returns +5 making it 10pm… any thoughts? this is little concerning…
You just have to change the sign if negative - make it positve, and vice versa.
I should point out that this new feature doesn’t work for me - I am storing the date/time in the table in UTC, and the APP automatically shows local time, based on the users time settings. The new feature requires calclulations in the data table - which I don’t want!
@AZJR are you still doing it your way, or my way?
… allright - I think I’ve got it now - and: @Jeff_Hager I’m using a combination, including your suggestion (thank you!!).
In general, here is what I found out:
- in a current version of glideapps the column type: “Date & Time” has a checkbox “Respect time zones” – this is helpful (in some scenarios) but:
- if I use “Date & Time” column type, enter the UTC time (i.e. 2024-08-22T17:00Z and check the box, the system will interpret as 5PM in my time zone (CDT) - thus, if I change zone in my system (to let say MDT), the Local time will be shown as 4PM (not 11AM as I’d expect)
So: in my case where I have a UTC date/time stamp and want to correctly present it across the time zones, while keeping that field intact, here is what I did:
- I kept my “matrix” date/time in text column: 2024-08-22T17:00Z (this one comes from google spreadsheet)
- duplicated it as a separate “Date & Time” column, without checking the “Respect time zones”
- created a TimeOffset column, using javascript: return -(new Date().getTimezoneOffset())/60, and finally
- created Local_Date math column, using Jeff’s
date + (TimeOffset/24)
formula, where “date” is replaced with my “Date & Time” type column
whew…
Thanks all to chiming in!
Here are screenshots: