Module:Sandbox/Hellknowz/Test: Difference between revisions

Content deleted Content added
typical
expand to allow output of hms
Line 90:
if (second and not checkIfSecondValid(second)) then return nil; end
 
-- time only
if (second) then return string.format('%d-%02d-%02d %02d:%02d:%02d', year, month, day, hour, minute, second)
if (second and not year) then return string.format('%02d:%02d:%02d', hour, minute, second)
elseif (minute and not year) then return string.format('%02d:%02d', hour, minute)
elseif (hour and not year) then return string.format('%02d', hour)
 
-- date and time
ifelseif (second) then return string.format('%d-%02d-%02d %02d:%02d:%02d', year, month, day, hour, minute, second)
elseif (minute) then return string.format('%d-%02d-%02d %02d:%02d', year, month, day, hour, minute)
elseif (hour) then return string.format('%d-%02d-%02d %02d', year, month, day, hour)
 
-- date only
elseif (day) then return string.format('%d-%02d-%02d', year, month, day)
elseif (month) then return string.format('%d-%02d', year, month)
elseif (year) then return string.format('%d', year)
else return nil end -- why are we here again?