Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.067 X-Spam-Evidence: '*H*': 0.87; '*S*': 0.00; 'argument': 0.05; 'string.': 0.05; 'skip:/ 10': 0.09; 'epoch': 0.16; 'subtract': 0.16; '>>>': 0.22; '>>>': 0.24; 'convenient': 0.24; 'message-id:@mail.gmail.com': 0.30; 'perl': 0.31; 'yesterday': 0.31; 'skip:d 20': 0.34; 'could': 0.34; 'received:google.com': 0.35; 'add': 0.35; 'there': 0.35; '8bit%:9': 0.36; "i'll": 0.36; 'seconds': 0.37; 'feed': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'easy': 0.60; 'today,': 0.61; 'name': 0.63; 'this...': 0.84; 'tomorrow': 0.95 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=LQqP2h5qYTUNvwvFuYCH4yOf/qeGLW+5tQXygshApSY=; b=qZP4uxOORj/bn2IfsZNOUNHBLMZoSXeP/dknUgfmz+mR0KuLjXsco28xp0PnDuqcRm +j0xYrXUh7hBhChexnH9iT6CMTNvbVHEJUwRAtYOElTh2qNbGpekZzB4j59vg2MttVZY LaGanI8qwwJid1XWNs4OSWAThgXv+b+UsM24k18O2v3W41F7WziZ6PoJKPIRD0uafxiA bu288QiTRR56EJhZdQzko3iiFMB86MIVFDdB4YK3hgUaCKy+MqnYUDgkg58+vufjb/Gz uSuwRwnE4TZ9KIqmsMejoF5raWSFgwna+iV95AdcvShbaI/VSo18GsAkwWO9Iu0yzn2x f53A== MIME-Version: 1.0 X-Received: by 10.229.179.65 with SMTP id bp1mr5040089qcb.11.1395848795225; Wed, 26 Mar 2014 08:46:35 -0700 (PDT) Date: Wed, 26 Mar 2014 11:46:35 -0400 Subject: datetime From: Victor Engle To: python-list@python.org Content-Type: multipart/alternative; boundary=001a11c2c10a99874604f5845f7b X-Mailman-Approved-At: Wed, 26 Mar 2014 22:22:47 +0100 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 60 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1395868967 news.xs4all.nl 2870 [2001:888:2000:d::a6]:58910 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:69145 --001a11c2c10a99874604f5845f7b Content-Type: text/plain; charset=UTF-8 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? --001a11c2c10a99874604f5845f7b Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I want to keep a collection of data organized by collectio= n 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

<= p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font-= family:Calibri,sans-serif">

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 da= te string.


It would be= convenient if =C2=A0datetime.date.today() accepted an argument as an offse= t from today, like datetime.date.today(-1). Is there an easy way to do this= with datetime?





--001a11c2c10a99874604f5845f7b--