Module:IxTime
Documentation for this module may be created at Module:IxTime/doc
local p = {}
local EPOCH = os.time({year=2020, month=10, day=4, hour=0, minute=0, second=0})
function p.convertToIxTime(frame)
local args = frame.args
local year = tonumber(args[1])
local month = tonumber(args[2])
local day = tonumber(args[3])
local hour = tonumber(args[4] or "0")
local minute = tonumber(args[5] or "0")
local second = tonumber(args[6] or "0")
if not year or not month or not day then
return "Error: Invalid date format"
end
local inputTime = os.time({year=year, month=month, day=day, hour=hour, minute=minute, second=second})
local secondsSinceEpoch = inputTime - EPOCH
local ixTime = math.floor(secondsSinceEpoch * 4.0 + EPOCH)
local ixDate = os.date("!%A, %B %d, %Y %H:%M:%S", ixTime)
return ixDate .. " IX"
end
return p