Content deleted Content added
No edit summary Tags: Mobile edit Mobile web edit Advanced mobile edit |
No edit summary Tags: Mobile edit Mobile web edit Advanced mobile edit |
||
(14 intermediate revisions by the same user not shown) | |||
Line 1:
local p = {}
local MONTH = {
January = 1, February = 2, March = 3, April = 4, May = 5, June = 6,
Line 6 ⟶ 7:
local function en_timestamp(date)
if date then
-- Format: DD-MM-YYYY
-- Format: DD Month YYYY
day, month, year = input:match("(%d+)%s+(%a+)%s+(%d+)")▼
if not (day and month and year) then
month = MONTH[month]▼
if month then
month = month:sub(1,1):upper() .. month:sub(2):lower()
▲ month = MONTH[month]
end
▲ end
return nil, "Invalid date format. Use DD
year = tonumber(year),
month = tonumber(month),
day = tonumber(day),
hour = 0
if not timestamp ▼
-- Add 6 hours to convert to UTC+6 (Bangladesh Time)
else
return os.time() + 21600 -- fallback to current time (UTC+6)
end
end
function p._main(date)
local UNIX, err = en_timestamp(date)
else
return UNIX - 1744610400
end
end
function p.main(frame)
local
local
if result then
▲ return BN_UNIX
return result
else
return err or "Invalid or missing date."
end
end
return p
|