Module:CurrentUTC
Appearance
Functions
[edit]now(frame)
[edit]- escription: Returns the current date and time in UTC.
- Parameters: `frame` (optional)
- Returns: A formatted string with date and time.
- Example:
{{#invoke:ModuleName|now}}
Features
[edit]- Full date display including day, month name, and year.
- Time shown in 24-hour format with leading zeros.
- Includes icons for a visually appealing display.
- Simple integration into any wiki page via `#invoke`.
Future Enhancements
[edit]- Multi-language support for month names.
- Option to display time in 12-hour format.
- Integration with local timezone modules for user-specific time.
Output
[edit]When used, the module will display something like this:
📅 Today: 13 November 2025 | 🕒 UTC: 14:37
local p = {}
-- Function to return current date and time in UTC
function p.now(frame)
local os_date = os.date("!*t") -- UTC time
local day = os_date.day
local month = os_date.month
local year = os_date.year
local hour = os_date.hour
local min = os_date.min
-- Month names in English
local months_en = {"January","February","March","April","May","June",
"July","August","September","October","November","December"}
local month_name = months_en[month]
-- Format date and time
local date_str = day .. " " .. month_name .. " " .. year
local time_str = string.format("%02d:%02d", hour, min)
return "📅 Today: " .. date_str .. " | 🕒 UTC: " .. time_str
end
return p
-- Categories for organization
[[Category:Lua libraries]]