Palindrome dates: Difference between revisions

Added Easylang
(New post with C++20 syntax and without external libraries. In addition to an existing post which uses the "Boost" library.)
(Added Easylang)
 
(3 intermediate revisions by 2 users not shown)
Line 952:
</pre>
 
 
=={{header|EasyLang}}==
<syntaxhighlight>
t = 1580641200
print "First 15 palindrome dates after 2020-02-02 are:"
repeat
t += 86400
a$ = timestr t
a$[] = strchars substr a$ 1 4 & substr a$ 6 2 & substr a$ 9 2
for i = 1 to 4
if a$[i] <> a$[9 - i]
break 1
.
.
if i = 5
cnt += 1
print substr a$ 1 10
.
until cnt = 15
.
</syntaxhighlight>
 
=={{header|F_Sharp|F#}}==
Line 1,647 ⟶ 1,668:
2190-09-12
</pre>
 
=={{header|Lua}}==
<syntaxhighlight lang="lua">
 
local year = 2020
for i=1, 15 do
local dateS
repeat
year = year+1
local yearS = tostring(year)
local monthS, dayS = yearS:reverse():match"^(%d%d)(%d%d)$"
local monthN, dayN = tonumber(monthS), tonumber(dayS)
dateS = yearS.."-"..monthS.."-"..dayS
until
monthN>0 and monthN<=12 -- real month
and dayN<32 -- possible day
and os.date( -- real date check
-- be aware that this check is unnecessary because it only affects the 13th century
"%Y-%m-%d"
,os.time{
year = year
,month = monthN
,day = dayN
}
) == dateS
print(dateS)
end
 
</syntaxhighlight>
 
=={{header|Mathematica}} / {{header|Wolfram Language}}==
Line 2,689 ⟶ 2,739:
{{libheader|Wren-fmt}}
{{libheader|Wren-date}}
<syntaxhighlight lang="ecmascriptwren">import "./fmt" for Fmt
import "./date" for Date
 
var isPalDate = Fn.new { |date|
2,069

edits