Palindrome dates: Difference between revisions
Content deleted Content added
No edit summary |
|||
Line 1,967:
...
</pre>
=={{header|Wren}}==
<lang vb>
Sub MainPalindromeDates()
Const FirstDate As String = "2020-02-02"
Const NumberOfDates As Integer = 15
Dim D As String, temp As String, Cpt As Integer
temp = Format(DateAdd("d", 1, CDate(FirstDate)), "yyyy-mm-dd")
Do
D = Replace(temp, "-", "")
If IsDatePalindrome(D) Then
Debug.Print Left(D, 4) & "-" & Mid(D, 5, 2) & "-" & Right(D, 2)
Cpt = Cpt + 1
End If
temp = Format(DateAdd("d", 1, CDate(temp)), "yyyy-mm-dd")
Loop While Cpt < NumberOfDates
End Sub
Function IsDatePalindrome(strDate As String) As Boolean
IsDatePalindrome = StrReverse(Left(strDate, 4)) = Right(strDate, 4)
End Function
</lang>
{{out}}The next 15 palindromic dates in yyyy-mm-dd format after 2020-02-02 are :
<pre>2021-12-02
2030-03-02
2040-04-02
2050-05-02
2060-06-02
2070-07-02
2080-08-02
2090-09-02
2101-10-12
2110-01-12
2111-11-12
2120-02-12
2121-12-12
2130-03-12
2140-04-12
</pre>
=={{header|Wren}}==
|