Module:Bengali Unix Timestamp
Appearance
![]() | This module is rated as alpha. It is ready for third-party input, and may be used on a few pages to see if problems arise, but should be watched. Suggestions for new features or changes in their input and output mechanisms are welcome. |
This is a module which gives the Unix Timestamp for Bengali Calender and It's calculated from the 1 Boisakh 1432 (14 April 2025). It is using UTC+6
The Current Timestamp is: 1745388000
Usage
{{#invoke:Bengali Unix Timestamp|main}}
Returns: 1745388000
We can also use the Gegorian Date to get the Bengali Timestamp of that day.
Like:
{{#invoke:Bengali Unix Timestamp|main|14 April 2025}}
Gives: 1744610400 [As it counts from 14 April 2025]
local p = {}
local monthMap = {
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 year, month, day
day, month, month = 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 = monthMap[month]
end
end
if not (year and month and day) then
return "Invalid date format. Use YYYY-MM-DD or DD Month YYYY."
end
local timestamp = os.time{
year = tonumber(year),
month = tonumber(month),
day = tonumber(day),
hour = 0
}
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] or "23 April 2025"))
local BN_UNIX = UNIX - 1744610400
return UNIX
end
return p