Hmmm Somebody has sneaked in a new, exciting feature?
What can we do with this?
NOW() returns the current local time. UTCNOW() returns the current UTC time,
Local time is convenient because it displays time in the local timezone basis that most people use day to day.
However, local time introduces problems for application developers.
One way of dealing with these problems is to record times in UTC. Having UTCNOW() enables that.
That is good background. I think you should have it included in the same help documentation too:
Also include Steveโs UTC Link:
It will work correctly not just the the DateTime, but the Date and Time column data types as well record the current Date and Time according to UTC respectively?
@aucforum
You can use DATE(UTCNOW()) and TIME(UTCNOW()) as an expression
Thank you LeventK.
Very simple and most useful.
Hi @Phil. Does this mean that Appsheet returns the UTC time from an online source independent from the time set on the device? This was a discussion on a past project where it seemed the user could determine the time AS posted by adjusting time set on their device.
Thanks
Is it true, @Aleksi? The function just removes the timezone adjustment, does it not? Itโs still subject to the phoneโs clock. If the user has manually set the phoneโs time, I would expect UTCNOW() to be affected by that.
For those who donโt know what UTC is:
@Gerald_Kariuki Yes thatโs true.
My bad, I read the question too quickly. Yes itโs filtering the timezone away from your deviceโs time.
So technically, the Appsheet with its UTCNOW() Function is receiving the date time AND the timezone (in a mutually recognizable format) from the device?
(For the record, this topic is converging with a similar one here:
)
PS: I am just trying to understand the mechanisms behind it so I can feel confident its working consistently and accurately.
It means thisโฆ
If you are using timezone +03 in your device and your time in that device is 06/15/2019 10:56AM, UTCNOW() will give you the result as 06/15/2019 07:56AM. If you change your time in your device, it will use that time when generating a DateTime value with this expression.
if you create an anction with this UTCNOW() and then trigger that action with the Data Change Workflow, it will read the Timestamp from the server. Then it doesnโt matter what the date or time you have in your device.
Some things to keep in mind. The user could disconnect from the internet, and then the server date time will be when the record is pushedโฆ Also keep in mind that both location and time can be โfakedโ by end usersโฆ
UTCNOW() used in a workflow rule cannot be faked by the enduser.
Thank you and the rest of the team for resolving this ambiguity.
UTCNOW() records the date time it was pushed/synced so if they were offline for two days and then synced that would all show 2 days after the device record creation? Correct?
When you say UTCNOW() used in a workflow rule, what do you want to say. sorry but im learning. How can i use UTCNOW() to verify that the user has not modified the time in the mobile?
Right, it it the time the workflow rule runs, but at least that cannot be compromised. Anything client side can be compromised.
Awesome, thanks for the clarification. Iโll for sure start leveraging it more!
User | Count |
---|---|
43 | |
28 | |
23 | |
14 | |
14 |