Module:DateDiff: Difference between revisions

From SilentBlue.RemyWiki
Jump to navigation Jump to search
(username removed)
No edit summary
(username removed)
No edit summary
Line 3: Line 3:
args=frame.args
args=frame.args
fromdate = os.time{year=args[1],month=args[2],day=args[3],hour=16} -- 7:00 AM UTC+9
fromdate = os.time{year=args[1],month=args[2],day=args[3],hour=16} -- 7:00 AM UTC+9
if args[4] ~= nil then
if args[4] ~= nil and args[4] ~= '' then
todate = os.time{year=args[4],month=args[5],day=args[6],hour=16} -- 7:00 AM UTC+9
todate = os.time{year=args[4],month=args[5],day=args[6],hour=16} -- 7:00 AM UTC+9
else
else

Revision as of 05:33, 13 June 2022

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

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