Reputation: 107
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:
It keeps returning local time instead of UTC.
Am I missing something?
The server is Windows Server 2012.
Upvotes: 1
Views: 294
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