Re: [Python-Dev] How do you get yesterday from a time object

2005-04-19 Thread Larry Bates
Use datetime module if you are on 2.3 or 2.4, otherwise you can do: today=time.time() yesterday=today-24*60*60 # 24 hours x 60 minutes x 60 seconds Your problem is that time.localtime() converts to 9 value tuple (you can't subtract seconds from a tuple). You do the math on today and convert usi

Re: [Python-Dev] How do you get yesterday from a time object

2005-04-19 Thread Simon Brunning
On 4/19/05, Ralph Hilton <[EMAIL PROTECTED]> wrote: > i'm a beginning python programmer. > > I want to get the date for yesterday > > nowTime = time.localtime(time.time()) > print nowTime. > oneDay = 60*60*24 # number seconds in a day > yday = nowTime - oneDay # <-- generates an error > print yd