Really weird, and I feel like I’m exploiting a bug a little bit to make this work…kinda…but not really. If I first picked a date column, then my GMT date column, then I would get the date formatting options. So, in the dropdown, if I picked a number column for the math replacement value, then my GMT date column, it would only give me the Precision rounding option. Also the formatting in the math column would only follow the column type from the previous selection. I was trying to do a simple date subtraction to get the number of days different, but it just wouldn’t do it. Kind of hard to explain, but I really fought with the math while trying to account for the hour of the day crossing different days. I think behind the scenes it’s seen as a date, but not quite. One bug I ran into is that creating the date with GMT template will allow it to convert to a date, and I can pick out pieces of it, such as year/month/day/hour/minute/second, but using it for basic date math just would not work (even when Math converting it to a date, it was still weird). I think my math is good, but it’s hard to say how it works around the world. Please let me know if something isn’t right. From what I can tell, I think it should work really well. I’m curious to see if others get the correct offset and GMT times. That part may be tricky depending on how you use it. I also assume that this would automatically account for daylight savings time changes, but not necessarily for future or past dates when DST differs from when DST is active or not. I’ve always suspected that the browser would be able to detect a user’s time zone and it appears that it can (at least Chrome). Image 554×563 25.4 I think the possibility is there for Glide to reasonably calculate this offset locally on the device without any server resources and do the calculations to determine GMT. Here is a small app that can be copied and shares the concept: System Date/GMT Concept (Actually just a template with a GMT time and the letters GMT, followed by a math column, would do that conversion.) I think this would be something great to put into a user profile table to automatically calculate the offset value, for each individual user, that could then be used throughout the app to convert a user’s entered local time into GMT and also convert it back to local time. Using that, you can then use some date math to determine your time zone offset and use that to convert a local time into GMT. What it did was assume that the date/time I entered was actually GMT and it automatically converted it into my local date/time. Using that idea, I tried plugging in a date/time into a date column and add GMT to the end of that date. I did some google searching to see if I could find a list of all of the different relative (word based) dates that could be plugged into a date column. I had discovered quite awhile ago that you could you could enter a relative date/time ( Fun with Dates), using words, into a date column and it would convert nicely into a date, so I’m assuming that somewhere within Glide is a Javascript or Typescript library that does that conversion. This thread ( ‘3 days ago’, ‘a month ago’ ‘tomorrow’ ) started to get me thinking about this again. But if you don’t know which time zone they are in, then you have no easy way to convert that date/time into something standard, like Greenwich Mean Time, to have a universal time that’s the same for all users. Most of you will know that any time your get a date/time from one of the glide special values, it will always be the user’s local time. There’s been a lot of questions for a while about how to get a universal time that can be shared for multiple users across multiple time zones. This is an extension of the request for System Time, please.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |