Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

relativedelta in Python 2.4

How can I get the month-ago date in Python 2.4?

In Python 2.5 it's easy:

onemonthago = datetime.date.today() + relativedelta(months = -1)
like image 792
Junix Avatar asked Sep 25 '26 03:09

Junix


1 Answers

relativedelta is a python-dateutil function, and dateutil is python2.4 compatible, so you should be able to use the same if you have dateutil installed.

like image 100
number5 Avatar answered Sep 26 '26 16:09

number5