Palindrome dates: Difference between revisions
Content added Content deleted
Alpha bravo (talk | contribs) (Added AutoHotkey) |
No edit summary |
||
Line 1,607: | Line 1,607: | ||
9280-08-29 |
9280-08-29 |
||
9290-09-29</pre> |
9290-09-29</pre> |
||
=={{header|QB64}}== |
|||
<lang QB64> |
|||
'Task |
|||
' Write a program which calculates and shows the next 15 palindromic dates |
|||
' for those countries which express their dates in the yyyy-mm-dd format |
|||
Dim dateTest As String, Mounth As Integer, Day As Integer, Year As Integer, Pal As Integer |
|||
dateTest = "" |
|||
Mounth = 0 |
|||
Day = 0 |
|||
Year = 0 |
|||
Pal = 0 |
|||
For Year = 2020 To 2420 |
|||
dateTest = LTrim$(Str$(Year)) |
|||
For Mounth = 1 To 12 |
|||
If Mounth < 10 Then dateTest = dateTest + "0" |
|||
dateTest = dateTest + LTrim$(Str$(Mounth)) |
|||
For Day = 1 To 31 |
|||
If Mounth = 2 And Day > 28 Then Exit For |
|||
If (Mounth = 4 Or Mounth = 6 Or Mounth = 9 Or Mounth = 11) And Day > 30 Then Exit For |
|||
If Day < 10 Then dateTest = dateTest + "0" |
|||
dateTest = dateTest + LTrim$(Str$(Day)) |
|||
'Print dateTest: Sleep |
|||
For Pal = 1 To 4 |
|||
If Mid$(dateTest, Pal, 1) <> Mid$(dateTest, 9 - Pal, 1) Then Exit For |
|||
Next |
|||
If Pal = 5 Then Print dateTest |
|||
dateTest = Left$(dateTest, 6) |
|||
Next |
|||
dateTest = Left$(dateTest, 4) |
|||
Next |
|||
dateTest = "" |
|||
Next |
|||
</lang> |
|||
=={{header|Raku}}== |
=={{header|Raku}}== |