LoTROInterface

LoTROInterface (https://www.lotrointerface.com/forums/index.php)
-   Tutorials & Other Helpful Information (L) (https://www.lotrointerface.com/forums/forumdisplay.php?f=21)
-   -   heres a function to convert localtime to UTC time (https://www.lotrointerface.com/forums/showthread.php?t=1659)

itsallhype820 10-20-2011 02:57 PM

heres a function to convert localtime to UTC time
 
Quote:

function getTimeTable()
local uTime, tTime, uSec, uHours, uMin, suf
local rTab = {};
tTime = Turbine.Engine:GetLocalTime();

uTime = tTime / 86400
uTime = math.floor(uTime)
uSec = tTime % 86400
uHours = math.floor(uSec / 3600)
uSec = uSec % 3600
uMin = math.floor(uSec / 60)
uSec = uSec % 60
if(uSec >= 1)then
if(uHours >= 12 ) then
suf = 1 -- pm
else
suf = 0 -- am
end
end
rTab.hours = uHours
rTab.min = uMin
rTab.sec = uSec
rTab.suffix = suf
return rTab
end
local bTab = getTimeTable();

Turbine.Shell.WriteLine("hours- " .. bTab.hours .. " min- " .. bTab.min .. " sec-" .. bTab.sec );
to obtain EDT EST PST etc just add or subtract to the hours output


All times are GMT -5. The time now is 01:32 AM.

vBulletin® - Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© MMOUI