Home
Random
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Unsigned
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
local p = {} -- There's probably a way to use strptime or some other more sophisticated way, but you're not supposed to be using a non-timestamp as input anyway. local function endswith(String,End) return End == '' or string.sub(String,-string.len(End)) == End end local function trim(s) return s:gsub("^%s+", ""):gsub("%s+$", ""):gsub("\226\128\142", "") end local function addUtcToStringIfItDoesNotEndWithUtc(s) if s == "" or endswith(s, "~~~~") then return s end if not endswith(s, "(UTC)") then return s .. " (UTC)" end return s end local function _main(args) local hopefullyTimestamp = args[1] or os.date('%H:%M, %d %B %Y (%Z)') return addUtcToStringIfItDoesNotEndWithUtc(trim(hopefullyTimestamp)) end function p.main(frame) local args if type(frame.args) == 'table' then -- We're being called via #invoke. The args are passed through to the module -- from the template page, so use the args that were passed into the template. args = frame.args else -- We're being called from another module or from the debug console, so assume -- the args are passed in directly. args = frame end return _main(args) end return p
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Tl
(
edit
)
Module:Unsigned/doc
(
edit
)