Re: Date strftime('%d%m%y') date to be of yesterday

Discussion in 'Python' started by Tim Golden, Oct 22, 2009.

  1. Tim Golden

    Tim Golden Guest

    baboucarr sanneh wrote:
    >
    > Hi all
    >
    > I want to output the date of the with this format strftime('%d%m%y') but the date ie '%d' should be the date of yesterday
    > eg
    >
    > import time
    > strftime('%d%m%y') # something like minus a day..
    > Thank you..am a newbie to python



    <code>
    import datetime
    yesterday = datetime.date.today () - datetime.timedelta (days=1)
    print yesterday.strftime ("%d%m%y")
    </code>

    TJG
    Tim Golden, Oct 22, 2009
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. -vr_stupids

    get "yesterday's" date in iso format

    -vr_stupids, Jan 23, 2004, in forum: Python
    Replies:
    4
    Views:
    4,170
    -vr_stupids
    Jan 24, 2004
  2. Thierry Lam

    Finding yesterday's date with datetime

    Thierry Lam, May 15, 2006, in forum: Python
    Replies:
    2
    Views:
    503
  3. Hussein B
    Replies:
    1
    Views:
    261
    Simon Brunning
    Jan 20, 2009
  4. D'Arcy J.M. Cain
    Replies:
    0
    Views:
    430
    D'Arcy J.M. Cain
    Oct 22, 2009
  5. Manny Chohan

    Calculate Yesterday Date

    Manny Chohan, Oct 4, 2004, in forum: ASP General
    Replies:
    4
    Views:
    184
    Dave Anderson
    Oct 4, 2004
Loading...

Share This Page