Palindromic dates are dates that appear as palindromes: the string of digits can be read the same way backwards as forwards. For the North American date format (MM/DD/YYYY), the next few palindromic dates are:
02/02/2020
12/02/2021
03/02/2030
The Challenge
Create a function that returns all palindromic dates in a consistent, common date format (of your choosing) that fall within a range of dates (edit: including the range itself).
Rules
- To qualify as a palindrome, only the numeric characters of the date should be checked.
- The date can be in any common format (
MM/DD/YYYY
,DD-MM-YYYY
), as long as it uses two digits for both the month and day and four for the year, and it uses a character to separate parts of the date. The output must preserve seperating characters (/
,-
, etc.). Your function only needs to handle one distinct date format. Please include the format in your answer. - If there are more than one dates returned, they should be comma or new-line separated.
- Shortest answer wins!
Example
date_palindrome('05/02/2050', '12/12/2060')
>>>['05/02/2050', '06/02/2060']
DATE
avoiding ato_date()
or I have to use the less golfableVARCHAR2
? \$\endgroup\$