470,636 Members | 1,616 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,636 developers. It's quick & easy.

Date calculation

I'm a Newbie.

Is there a method in Python to display yesterday's date?

ie: Yesterday = Today - 1day

Jul 18 '05 #1
2 1983
David Mostert wrote:
I'm a Newbie.

Is there a method in Python to display yesterday's date?

ie: Yesterday = Today - 1day


http://www.python.org/doc/2.3.4/lib/...-datetime.html

datetime.date.today() - datetime.timedelta(days=1)

--
Yermat

Jul 18 '05 #2
In article <ma*************************************@python.or g>,
"David Mostert" <je******@yahoo.com> wrote:
I'm a Newbie.

Is there a method in Python to display yesterday's date?

ie: Yesterday = Today - 1day


import time
yesternow = time.time() - 24 * 60 * 60.0
print time.ctime (yesternow)
Does a little more than you want.

Regards. Mel.
Jul 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Manny Chohan | last post: by
1 post views Thread by mene | last post: by
4 posts views Thread by Richard Hollenbeck | last post: by
3 posts views Thread by Lindie | last post: by
2 posts views Thread by smcgrath via AccessMonster.com | last post: by
6 posts views Thread by krishnakant Mane | last post: by
16 posts views Thread by W. eWatson | last post: by
1 post views Thread by Korara | last post: by
???
reply views Thread by Stoney L | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.