I need yesterdays date in YYYY-MM-DD
Thanks
asked 14 Dec '11, 10:46
fox ♦♦ 800●16●25●27 accept rate: 37%
This is how I would do it:
>>> import datetime as dt >>> yesterday = dt.datetime.now() - dt.timedelta( days = 1 ) >>> print yesterday.strftime( '%Y-%m-%d' ) 2011-12-13
answered 14 Dec '11, 10:50
Russell Ball... 1.3k●23●29●37 accept rate: 43%
Once you sign in you will be able to subscribe for any updates here
Answers
Answers and Comments
Markdown Basics
learn more about Markdown
Tags:
python ×7 date ×1 datetime ×1 yesterday ×1
Asked: 14 Dec '11, 10:46
Seen: 2,533 times
Last updated: 14 Dec '11, 10:50
how to create a buildout file
Does tornado have else statements in template?
easy_install EnvironmentError: mysql_config not found
How can I determine if an ip address exists inside a cidr range in python?
What is the best way to fetch a webpage in python?
How do you choose a random record from a python dict
powered by OSQA
First time here? Check out the FAQ!