Quantcast
Channel: Rainmeter Forums
Viewing all articles
Browse latest Browse all 1385

Lua Scripting • Re: Working with date / time in Lua

$
0
0
Hey JS, what if my skin is already working and set up using windows filetime (january 1 1601) and I want to parse that timestamp to lua as a global variable? I want to call "[&TimeMeasure:timestamp]".

For example:

Code:

timeMS = SKIN:GetMeasure('Time')   timestamp = tonumber(timeMS:GetValue())
That won't work
Lua:

Code:

function ConvertTime(n, To)local Formats = {Unix    = -1,Windows = 1}return Formats[To] and n + 11644473600 * Formats[To] or nilend
So the long and the short of it is that you add 11644473600 to a Windows timestamp value to turn it into a Unix timestamp value.

Statistics: Posted by jsmorley — Yesterday, 6:30 pm



Viewing all articles
Browse latest Browse all 1385

Trending Articles