I need yesterdays date in YYYY-MM-DD
Thanks
asked 14 Dec '11, 10:46
fox ♦♦ 536●16●20●20 accept rate: 33%
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.1k●22●28●34 accept rate: 37%
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 ×6 date ×1 datetime ×1 yesterday ×1
Asked: 14 Dec '11, 10:46
Seen: 623 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?
powered by OSQA