Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #69145 > unrolled thread

datetime

Started byVictor Engle <victor.engle@gmail.com>
First post2014-03-26 11:46 -0400
Last post2014-03-26 11:46 -0400
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

  datetime Victor Engle <victor.engle@gmail.com> - 2014-03-26 11:46 -0400

#69145 — datetime

FromVictor Engle <victor.engle@gmail.com>
Date2014-03-26 11:46 -0400
Subjectdatetime
Message-ID<mailman.8588.1395868967.18130.python-list@python.org>

[Multipart message — attachments visible in raw view] — view raw

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?

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web