Module:Sandbox/Elli/SignatureDateConvert
Jump to navigation
Jump to search
File:Test Template Info-Icon - Version (2).svg Module documentation[view] [edit] [history] [purge]
| File:Greek lc beta icon.svg | This module is rated as beta. It is considered ready for widespread use, but as it is still relatively new, it should be applied with some caution to ensure results are as expected. |
Usage
[edit source]This module is used for converting dates that are in signatures to YYYY-MM-DD, so they can be used sort-ably in tables.
Example
[edit source]{{#invoke:Sandbox/Elli/SignatureDateConvert|sigConv|timestamp=02:19, 7 March 2021 (UTC)}}
2021-03-7
Current uses
[edit source]See {{User:Elli/SigTableSort}}.
local p = {}
function p.sigConv(frame)
s = frame.args.timestamp
r="(%d+):(%d+), (%d+) (%a+) (%d+) %(UTC%)"
hour,min,day,month,year=s:match(r)
MON={January="01",February="02",March="03",April="04",May="05",June="06",July="07",August="08",September="09",October="10",November="11",December="12"}
month=MON[month]
return year .. "-" .. month .. "-" .. day
end
return p