Why does today() function always returns day in GMT instead of day in the current user time zone set in profile. To overcome this we had to build a rule to return date in user time zone. Is this expected behaviour of today() function because it is no where mentioned in documentation that function always returns date in GMT
Discussion posts and replies are publicly visible
Returning date in GMT is a behaviour of today(). But now() returns date and time in the user time zone.
You can use something like this to get date of user's timezone
Thanks for the response but my question was why does today() return date in GMT. I was able to get user date in respective to Time Zone with additional code anyways
The Appian Server stores all data in GMT.
Each user in turn can set their timezone thru the Appian User Settings. Calling the usertimezone function then allows you to identify the users timezone and cast the date/time on screen to the users locale.
I get it. But now() returns date time in user locale and today() does not that is weird from product stand point
as far as I know, now() actually returns a UTC timecode which is just translated into the user's local time when cast as text by Appian's rendering engines. But the internal value returned by now() would be the same if run at the same (GMT) time by two users in different timezones. So in that sense it works similarly to today(). I agree it's all pretty confusing, though that's more the fault of having so many different timezones with so many exceptions and caveats, than the fault of Appian.
That is interesting mike thanks for the explanation. I might try to execute the now() at GMT with different user time zones.
To test my theory, I ran the following code here in my EST dev environment:
and when viewing Expression output, I get a number starting with -5548.227 (and several more digits that are changing too rapidly for me to report here).
© 2021 Appian. All rights reserved.