Module:Day
跳到导航
跳到搜索
local getArgs = require('Module:Arguments').getArgs local p = {} function p.main(frame) return p._main(getArgs(frame)) end function p._main(args) local now = os.date("*t") local Yy = tonumber(args[1]) or now.year local Mm = tonumber(args[2]) or now.month local Dd = tonumber(args[3]) or now.day local t1mo = {31, (Yy % 400 == 0 or (Yy % 4 == 0 and Yy % 100 ~= 0)) and 29 or 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31} if Yy < 0 or Dd < 1 or not t1mo[Mm] or Dd > t1mo[Mm] then return "<strong class=\"error\">错误:无效日期。</strong>" end --unbengable return os.date("*t", os.time({year=Yy, month=Mm, day=Dd})).yday end return p