Module:DateUtil

Jump to navigation Jump to search
Documentation[create] [refresh]
This module has no documentation. If you know how to use this module, please create it.
local p = {}

function p.getDay(arg)
	return os.date("!*t")["day"]
end

function p.getMonth(arg)
	return os.date("!*t")["month"]
end

function p.getYear(arg)
	return os.date("!*t")["year"]
end

function p.getHour(arg)
	return os.date("!*t")["hour"]
end

function p.getMinute(arg)
	return os.date("!*t")["min"]
end

function p.getSecond(arg)
	return os.date("!*t")["sec"]
end

function p.getWeekday(arg)
	local wd = os.date("!*t")["wday"]
	if wd==1 then wd=8 end
	return wd
end

function p.getFormattedDateForSignature(arg)
	local now = os.date("!*t")
	local minute = now["min"]
	if minute < 10 then minute = "0" .. minute end
	local second = now["sec"]
	if second < 10 then second = "0" .. second end
	return now["hour"] .. "h" .. minute .. ":" .. second .. " | " .. now["day"] .. "/" .. now["month"] .. "/" .. now["year"] .. " (UTC)"
end

return p