Skip to content

Instantly share code, notes, and snippets.

@paulgear
Created December 2, 2021 04:48
Show Gist options
  • Save paulgear/464a1105e1de52e476d26b38185a3260 to your computer and use it in GitHub Desktop.
Save paulgear/464a1105e1de52e476d26b38185a3260 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import datetime
def all_dates(beginyear = 2000, endyear = 2100):
for year in range(beginyear, endyear):
for month in range(1, 13):
for day in range(1, 32):
try:
yield datetime.date(year, month, day)
except ValueError:
pass
print('Palindates:')
for d in all_dates():
datestr = d.isoformat().replace('-', '')
if datestr == ''.join(reversed(datestr)):
print(d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment