Timezone- what is the default esp when using now()

should not NOW() return the time in the time zone of the device it is running on? I have a feeling it is NOW() at ZULU0 and NOT ZULU-4 where I am.

And…

If I save the field as NOW(), it saves it as +4 hours, ie Zulu ie GMT
if I save it as SUBTRACT_DURATION(NOW(), 4,“hours”), same, +4 hours from what my time is.

Hi, you’re right – NOW() returns the time in GMT. LOCAL_TIMEZONE() finds the device’s timezone and SET_TIMEZONE(NOW(), LOCAL_TIMEZONE()) returns the local time.

As to why the SUBTRACT_DURATION(...) formula didn’t work in this case it’s hard to say, when I tried for me it does give a time 4 hours before NOW(). :thinking:

Here is my code:


Here is the flow…

2021-04 at 830 pm my local time ie 20:30 European format. date time stored is: 2021-01-05T00:30:31.229Z

??? midnight 4 hours later instead of my local time which h is -4 GMT. confused.

MY GUESS. Time in stored correctly BUT now displays as if it were GMT. Do not understand why NOW() is not NOW() local time on the device in hand, and why it does not display same.

So to that end, I coded SET_TIMEZONE(current.Date, LOCAL_TIMEZONE()) to display the date and now its is fine. Baffled why it is done in such a way. Well, maybe not. Just unexpected.

Cheers.

Yeah, I guess dates and times are in the area where the inner workings of the program kind of overrule human understandability – computers don’t really care if it’s day or night or if the date is presented as a timestamp or nicely formatted text. :smile: From the user’s perspective this is of course a bit inconvenient, but then we can format things and convert to local timezones for display purposes. Just as a tip, this is also a good formula if you want to display the times in even better readable formats. :slight_smile:

1 Like