Module:DateDiff

Revision as of 04:57, 13 June 2022 by (username removed) (Created page with "local p={} function p.DateDiff(frame) args=frame:getParent().args fromdate = os.time{year=args[1],month=args[2],day=args[3],hour=16} -- 7:00 AM UTC+9 if args[4] ~= nil then todate = os.time() else todate = os.time{year=args[4],month=args[5],day=args[6],hour=16} -- 7:00 AM UTC+9 end diff = math.floor(os.difftime(todate,fromdate) / 86400) return diff end return p")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:DateDiff/doc

local p={}
function p.DateDiff(frame)
	args=frame:getParent().args
	fromdate = os.time{year=args[1],month=args[2],day=args[3],hour=16} -- 7:00 AM UTC+9
	if args[4] ~= nil then
		todate = os.time()
	else
		todate = os.time{year=args[4],month=args[5],day=args[6],hour=16} -- 7:00 AM UTC+9
	end
	diff = math.floor(os.difftime(todate,fromdate) / 86400)
	return diff
end
return p