How to get the device time?

I need to take the device time (which will always be local time to where the device is located). NOW() is taking time in UTC time zone. How to get the local time from the device?

1 Like

Use FORMAT_DATETIME_LOCAL()

1 Like

Thanks, John. For those interested, FORMAT_DATETIME_LOCAL() return a text and therefore you can’t make operations with it. Use DATETIME to convert back to date variable: DATETIME(FORMAT_DATETIME_LOCAL(NOW(),"YYYY-MM-DD HH:MM:SS"))

2 Likes

You can also use DATETIME() to format the result of a TIMESTAMP()