Module:SignatureDateConvert

MyWikiBiz, Author Your Legacy — Wednesday December 25, 2024
Jump to navigationJump to search

Template:Module rating

Usage

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

{{#invoke:SignatureDateConvert|sigConv|timestamp=02:19, 7 March 2021 (UTC)}}

2021-03-7

Current uses

See Template:T.


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