I need yesterdays date in YYYY-MM-DD
Thanks
asked 14 Dec '11, 10:46
fox ♦♦ 626●16●21●23 accept rate: 30%
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.2k●22●29●36 accept rate: 41%
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: 1,050 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