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 |
||
(20 intermediate revisions by the same user not shown) | |||
Line 1:
local p = {}
local
January = 1, February = 2, March = 3, April = 4, May = 5, June = 6,
July = 7, August = 8, September = 9, October = 10, November = 11, December = 12
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 = monthMap[month]▼
if month then
month = month:sub(1,1):upper() .. month:sub(2):lower()
end
▲ end
return nil, "Invalid date format. Use
year = tonumber(year),
month = tonumber(month),
day = tonumber(day),
hour = 0
-- 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)
▲ return timestamp
local UNIX, err = en_timestamp(date)
if not UNIX then
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
|