Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Jan 26th, 2006, 5:30 PM   #1
Steveire
Newbie
 
Join Date: Jan 2006
Posts: 13
Rep Power: 0 Steveire is on a distinguished road
I can print 'today', but can I print 'yesterday'?

import time
today = time.strftime("%d %B %Y")
yesterday = str(int(time.strftime("%d"))-1) + time.strftime(" %B %Y")
print today, yesterday
Will work only if 'today' is not the first day of the month, otherwise, it will tell me that yesterday is the 0th of February for example. Is there a SMRT way to use the time module (or any other) to get 'yesterday'?

Aside:
Rather than bumping the other thread again: I got a working MediaWiki bot after finding I was using the wrong version of python with the pywikipediabot.
Steveire is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:17 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC