modifying a time.struct_time
Chris Angelico
rosuav at gmail.com
Fri Dec 16 05:44:42 EST 2011
On Fri, Dec 16, 2011 at 8:45 PM, Ulrich Eckhardt
<ulrich.eckhardt at dominolaser.com> wrote:
> I'm trying to create a struct_time that is e.g. one year ahead or a month
> back in order to test some parsing/formatting code with different dates.
Do you need it to be one exact calendar year, or would it make sense
to add/subtract integers from a Unix time?
t = time.time() + 365*86400 # Not actually a year ahead, it's 365 days ahead
t = time.localtime(t) # if you want a struct_time
ChrisA
More information about the Python-list
mailing list