Skip to content

Instantly share code, notes, and snippets.

@julian-amaya
Created May 2, 2012 22:04
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 julian-amaya/2580914 to your computer and use it in GitHub Desktop.
Save julian-amaya/2580914 to your computer and use it in GitHub Desktop.
el dia en el mes pasado
from datetime import date, timedelta
hoy = date.today()
if hoy.month == 1:
min_prev_invoice_date = hoy - timedelta(days=31)
else:
try:
min_prev_invoice_date = hoy.replace(month=hoy.month-1)
except:
min_prev_invoice_date = hoy.replace(day=1)
min_prev_invoice_date = min_prev_invoice_date - timedelta(days=1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment