如何在Python2.4中获取一个月前的日期?
在Python 2.5中,这很简单:
onemonthago = datetime.date.today() + relativedelta(months = -1)发布于 2011-12-05 20:57:54
relativedelta是一个python-dateutil函数,并且与python2.4兼容,所以如果您安装了dateutil,您应该能够使用相同的函数。
https://stackoverflow.com/questions/8385544
复制相似问题