Palindrome dates: Difference between revisions
Content added Content deleted
imported>Nmz (Added Lua section {{header|lua}}) |
imported>Nmz m (→Lua: day>0 cond unnecessary) |
||
Line 1,659: | Line 1,659: | ||
local monthS, dayS = yearS:reverse():match"^(%d%d)(%d%d)$" |
local monthS, dayS = yearS:reverse():match"^(%d%d)(%d%d)$" |
||
local monthN, dayN = tonumber(monthS), tonumber(dayS) |
local monthN, dayN = tonumber(monthS), tonumber(dayS) |
||
dateS = yearS |
dateS = yearS.."-"..monthS.."-"..dayS |
||
until |
until |
||
monthN>0 and monthN<=12 -- real month |
monthN>0 and monthN<=12 -- real month |
||
and dayN<32 -- possible day |
|||
and os.date( -- real date check |
and os.date( -- real date check |
||
-- be aware that this check is unnecessary because it only affects the 13th century |
|||
"%Y-%m-%d" |
"%Y-%m-%d" |
||
,os.time{ |
,os.time{ |