As I understand it, created, the system column, is in UTC. Because of daylight savings time, the offset between UTC and East Coast Time is -4 or -5. So I can’t simply use a fixed offset.
I haven’t found a code block (this is what I’m probably missing) that can tell me the current offset to UTC.
So this is my solution. Does anyone have a suggestion for a better way?
GMT : Thursday, August 10, 2023 12:00:00 AM Your time zone : Wednesday, August 9, 2023 8:00:00 PM [GMT-04:00]
Using that in a query would return rows created from 8:00:01 to 12:00:00 yesterday in local time. The goal is to only return rows created today in local time.
@mark-piller I didn’t realize the Date Now block returned local time.
Is it possible there is a bug in the set " " for date block? If I set the hours to zero for Date Now, I would expect that to retain the local time. However, the result for set hours and set UTChours are identical -
Thu Aug 10 2023 00:11:47 GMT+0000 (Coordinated Universal Time)
Thu Aug 10 2023 00:11:47 GMT+0000 (Coordinated Universal Time)
I would expect dateNowLocal to retain the time offset of -4 for Boston OR be offset of GMT by -4. This functionally turned local time into GMT.
Local time 00:00:00 - Thu Aug 10 2023 00:00:00 GMT-0400 (Eastern Daylight Time)
UTC time 00:00:00 - Wed Aug 09 2023 20:00:00 GMT-0400 (Eastern Daylight Time)
@mark-piller are you testing this in UI Builder? I am guessing you are, based on your suggestion of using prints. I am working in Codeless and it returns different results. See above.
I assume by “Codeless” you mean Cloud Code? Codeless is the visual programming system that is present in both UI Builder and Cloud Code.
In the case of Cloud Code, the behavior IS going to be different, because in UI Builder the browser itself does the timestamp conversions. In Cloud Code the returned date is always in UTC, there is no concept of the local timezone