datetime

Victor Engle victor.engle at gmail.com
Wed Mar 26 11:46:35 EDT 2014


I want to keep a collection of data organized by collection date and I'll
use datetime like this...

>>> datetime.date.today()

datetime.date(2014, 3, 26)


I'll format the date and create directories like /mydata/yyyy-mm-dd


When I create a directory for today, I need to know the directory name for
yesterday and tomorrow. In perl I could get seconds since the epoch using
time and then add or subtract from that number for tomorrow or yesterday
and feed that into localtime to get the date string.


It would be convenient if  datetime.date.today() accepted an argument as an
offset from today, like datetime.date.today(-1). Is there an easy way to do
this with datetime?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20140326/edeaf98b/attachment.html>


More information about the Python-list mailing list