Does anyone have a YC to change the time zone of a certain date?
Ohh, ok will try thanks
not working.
Whats Locale?
tried dd.MM.yyyy HH:mm
UTC+3
You can use the format date with configuration Z
Then, On the profile table have a Format Date with Z. This will have the timezone for that particular user.
Wherever you are housing a date and time:
- make sure you have the user’s that creates that date timezone.
- have another Date format Z.
- then use a math column to calculate the difference
- another math column that add the time difference to the date. = date + (timedifference/24)
I hope this helps.
Can I get an example of format Z?
How do I get the time zone of the user?
Can you please get in to a little more detail?
Like this:
!This is how I learned to convert the time to the user timezone. @George-Glide is the brains behind this
I hope this will help you a bit. Luxon is JS library that is used for formating date and time in experimental columns in Glide.
Here’s a sample app:
May we know more about your use case here? What’s your input, why do you need to change the time zone and what’s the expected output?
I want to change the date format and add glide relative time column but they show always +3 hours from my date column.
I have another YC column for the format that works well but I still would like to use the relative column.
I want to substract 3 hours from my date and assign this column to the relative time.
In a math column: Date - (3/24)
Here is a bit simpler way to get the timezone offset for the device using a Code/Javascript column.
The use case I can think of is that if you allow anyone to schedule things and they are in different time zones, you would save both the date/time as well as the timezone offset when the user creates the event. This way you can always calculate the events’ time shown in the user’s time, by doing some math with the saved timezone offset of the event and the current users’ timezone offset.
return (new Date().getTimezoneOffset())/60
Hi Darren,
I tried using this as it seems the easiest solution but the Glide Relative Time column does not recognize the math column as date.
I tried to format it to date, tried to use a template column to turn it to text and then format back to date, but still nothing.
did I miss something?
also why is it so hard to get the relative time in the same time zone as the date that is the parameter? There is a parameter called “now” but if I use it it I also dont get a result even on the regular date column.
Maybe someone has a YC column for relative time?
So If I get it this right, I dont need to select a date because this returns the timezone offset of the local device calculating this from glides server timezone?
I think some of the date plugins have issues with non US locale and date format. I’ve been using them with extreme caution.
What is your end goal here?
Do you just want to determine the users UTC offset and then apply that as a correction?
If yes, I’d go with the JS one-liner that @George-Glide provided. I think that’s going to be the most reliable at the moment.
Ok yes but it returns an integer.
I need the actual date in datetime format so the relative time column could calculate it
That integer represents the number of hours between UTC and the users local time.
For example, I’m in Singapore which is UTC+8. So for me it returns -8.
To use it to convert UTC to users local time, you actually need to invert it first and then add it to a date/time using a math column. Here is how I’ve used it in one of my apps:
Note that I adjusted the code slightly to invert the result, because I want to use it as a correction:
return -(new Date().getTimezoneOffset())/60
Then I use it as follows to convert a UTC timestamp to Users Local time:
In the example above, T (Timestamp) is a UTC timestamp. So I’m just taking that and adding the UTC offset hours to get local time.
In your case, you may need to use it slightly differently, but hopefully this gives you the idea.
I got the Idea, thank you for the clear explanation.
But I still get the end date result in a math column and the relative time column doesn’t recognize it.
I guess I will have to write this result on every form submission to a date column and then use the relative time.
Thank you
Yes, I believe this is a bug where the Relative Time Plugin isn’t dealing correctly with your locale and/or date format. I have the same problem with a number of the Date plugins.