Users Current Time Zone

Alex3
New Member

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 Solved
0 15 562
1 ACCEPTED SOLUTION

TOTALSECONDS(UTCNOW() - "1/1/1970 00:00:00")

View solution in original post

15 REPLIES 15

Steve
Platinum 4
Platinum 4

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")

Alex3
New Member

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.

Top Labels in this Space