Hello,
Is it possible to determine the current time zone of the user and return the value into a table?
I tried to find the current time zone data in the CONTEXT options.
Thanks,
Alex
Solved! Go to Solution.
TOTALSECONDS(UTCNOW() - "1/1/1970 00:00:00")
Thereโs no direct way to get it, but you can compute the time zone offset from UTC with:
(NOW() - UTCNOW())
Thanks Steve,
Below is my use case. I am trying to covert my โTask Start Timeโ field to
Unix Time. If NOW () always gives me the current time for the user (based on
their time zone), is there a way to convert the formula below, to get the
UNIX equivalent of my โTask Start Timeโ?
(HOUR(DATE(NOW()) - โ01/01/1970โ))*3600 + (MOD(HOUR(NOW() -
โ01/01/1970โ),HOUR(DATE(NOW()) - โ01/01/1970โ)))*3600 +
MINUTE(NOW() - โ01/01/1970โ)*60 +
SECOND(NOW() - โ01/01/1970โ)
I tried to replace NOW() with DATETIME(โTask Start Timeโ) but it did not
work
https://community.appsheet.com/t/is-it-possible-to-generate-a-unix-timestamp
-w/2337/2
TOTALSECONDS(UTCNOW() - "1/1/1970 00:00:00")
Perfect
Thank you Steve
Related question. Is it possible to convert a date time field, that is not the current time, to Unix. In other words, if the โTask Start Timeโ was entered as April 23, 6:00 AM and we need the equivalent Unix โTask Start Timeโ instead of the current Unix Time
Maybe this:
TOTALSECONDS([Task Start Time] - "1/1/1970 00:00:00" + (NOW() - UTCNOW()))
Hi Steve,
This worked perfectly.
Thanks,
Alex
Hi Steve,
Actually, for some reason the results are off by exactly 12 hours.
What is the time zone of the device performing the computation? Is it 12 hours off UTC?
The time zone of the device is (MST) UTC-7
The (NOW() - UTCNOW() portion of the formula seems to be doing the time zone
offset correctly.
UNIX Epoch is 1/1/1970 00:00:00.
Everything looks like it should work, even with Daylight Saving Time. But
for some reason, all the Unix results are exactly 12 hours greater than they
should be
Where are you observing the incorrect value?
When I use the Test function in the Expression editor
Hmmโฆ Itโs working fine for me. Is [Task Start Time]
a DateTime value?
Yes. Correct, Task Start Time is a DateTime value
Should I try logging out of Appsheet and logging in again?
You could, but I wouldnโt expect it to have any effect.
Iโm kinda at a loss here. I think perhaps itโs time to engage support@appsheet.com for a deeper look.
User | Count |
---|---|
44 | |
28 | |
28 | |
21 | |
13 |