Module:Bengali Calendar Epoch Offset
Appearance
local p = {}
local MONTH = {
January = 1, February = 2, March = 3, April = 4, May = 5, June = 6,
July = 7, August = 8, September = 9, October = 10, November = 11, December = 12
}
local function en_timestamp(date)
local input = date
local timestamp
local year, month, day
if date then
day, month, year = input:match("(%d+)%-(%d+)%-(%d+)")
if not (year and month and day) then
day, month, year = input:match("(%d+)%s+(%a+)%s+(%d+)")
if month then
month = MONTH[month]
end
end
if not (year and month and day) then
return "Invalid date format. Use DD-YYYY-MM or DD Month YYYY."
end
timestamp = os.time{
year = tonumber(year),
month = tonumber(month),
day = tonumber(day),
hour = 0
}
else
timestamp = os.time()
end
timestamp = timestamp - os.difftime(os.time(), os.time(os.date("!*t"))) + 21600
return timestamp
end
function p.main(frame)
local UNIX = tonumber(en_timestamp(frame.args[1]))
local BN_UNIX = UNIX - 1744610400
return BN_UNIX
end
return p