arleitiss
arleitiss

Reputation: 107

Lua Retrieving time in UTC returns local time anyway

I am using Lua in Iguana (Interfaceware)

I have server that's located in AEST timezone and I am trying to get time in UTC like this:

   trace(os.time(os.date('!*t'))) 
   trace(os.time(os.date('*t')))
   trace(os.time(os.date('!%c')))

This is the output I am getting:

enter image description here It keeps returning local time instead of UTC.

Am I missing something?

The server is Windows Server 2012.

Upvotes: 1

Views: 294

Answers (1)

amin saffar
amin saffar

Reputation: 2041

To get time in UTC use ! :

os.date('!%c')

check your time zone first by this code

local now = os.time()
localtime_minus_UTC = os.difftime(os.time(os.date("*t", now)),
                                  os.time(os.date("!*t", now)))

Upvotes: 0

Related Questions