Module:Date
Documentation for this module may be created at Module:Date/doc
local p = {}
local months = {
"January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"
}
local function format_date(date_string)
-- Split the date string into month, day, and year
local month, day, year = date_string:match("(%d%d)-(%d%d)-(%d%d%d%d)")
if month and day and year then
-- Convert month number to month name
local month_name = months[tonumber(month)]
-- Convert day (removing leading zero if needed)
local day_num = tonumber(day)
-- Return formatted date
return string.format("%s %d, %s", month_name, day_num, year)
else
-- Return the original string if the format doesn't match
return date_string
end
end
return p