模块:GachaTime

来自维阿百科
跳转至: 导航搜索

此模块的文档可以在模块:GachaTime/doc创建

local p = {}

function p.time_format(frame)
	local args = (frame == mw.getCurrentFrame() and frame.args) or frame
	
	local ts = tonumber(args.ts or "0")
	local tz = tonumber(args.tz or "8")
	
	local date_format = os.date
	local string_format = string.format
	local date_table = date_format('!*t', ts + tz * 3600)
	
	return string_format('%04d.%d.%d', date_table.year, date_table.month, date_table.day)
end

return p