incrementing a time tuple by one day

David Stockwell winexpert at hotmail.com
Thu Sep 23 12:22:08 EDT 2004


I'm sure this has been asked before, but I wasn't able to find it.

First off I know u can't change a tuple but if I wanted to increment a time 
tuple by one day what is the standard method to do that?

I've tried the obvious things and haven't gotten very far.

I have a time tuple that was created like this:
aDate = '19920228'
x = time.strptime(aDate,"%Y%m%d")
print x
(1992, 2, 28, 0, 0, 0, 4, 59, -1)

y = time.mktime(x) + time.mktime((0,0,1,0,0,0,0,0,0))
print y
1643277600.0
print time.ctime(y)
'Thu Jan 27 05:00:00 2022'

It appears to have decremented by a day and a month instead of increment.

What am I doing wrong?

Thanks




David
-------
Surf a wave to the future with a free tracfone 
http://cellphone.duneram.com/index.html

_________________________________________________________________
Check out Election 2004 for up-to-date election news, plus voter tools and 
more! http://special.msn.com/msn/election2004.armx




More information about the Python-list mailing list