Today   (2020-02-02,   at the time of this writing)   happens to be a palindrome,   without the hyphens,   not only for those countries which express their dates in the   yyyy-mm-dd   format but,   unusually,   also for countries which use the   dd-mm-yyyy   format.



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.




 
'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
' and for those countries which express their dates int dd-mm-yyyy format
' the user will choose what format to use for calculating
Dim dateTest As String, Mounth As Integer, Day As Integer, Year As Integer, Pal As Integer, choice As Integer
dateTest = ""
Mounth = 0
Day = 0
Year = 0
Pal = 0
choice = 0
Print " choose date format:"
Print " press 1 for using YYYY-MM-DD format"
Print " press 2 for using DD-MM-YYYY format"
 
While choice < 1 Or choice > 2
    choice = Val(InKey$)
Wend
Print " Well, you have choosen format number "; choice
Sleep 2
For Year = 2020 To 2420
    dateTest = LTrim$(Str$(Year))
    For Mounth = 1 To 12
        If Mounth < 10 Then k$ = "0" Else k$ = ""
 
        If choice = 1 Then
            dateTest = dateTest + k$ + LTrim$(Str$(Mounth))
        Else
            dateTest = k$ + LTrim$(Str$(Mounth)) + dateTest
        End If
 
 
        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 k$ = "0" Else k$ = ""
            If choice = 1 Then
                dateTest = dateTest + k$ + LTrim$(Str$(Day))
            Else
                dateTest = k$ + LTrim$(Str$(Day)) + dateTest
            End If
            '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
            If choice = 1 Then
                dateTest = Left$(dateTest, 6)
            Else
                dateTest = Right$(dateTest, 6)
            End If
        Next
        If choice = 1 Then
            dateTest = Left$(dateTest, 4)
        Else
            dateTest = Right$(dateTest, 4)
        End If
    Next
    dateTest = ""
Next
 
 
 