Skip to content

Instantly share code, notes, and snippets.

@hughdbrown
Created May 6, 2019 04:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hughdbrown/7bdc932f7d4271d9289f2630e193c390 to your computer and use it in GitHub Desktop.
Save hughdbrown/7bdc932f7d4271d9289f2630e193c390 to your computer and use it in GitHub Desktop.
Generate end of month strings
from datetime import datetime, timedelta
for year in range(2006, 2020):
for month in range(1, 13):
# Get the last day of the previous month
d = datetime(year, month, 1) - timedelta(1)
print(d.strftime("%Y-%m-%d"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment