tomorrow in yyyymmdd format
Sean 'Shaleh' Perry
shalehperry at attbi.com
Tue Jun 18 21:38:10 EDT 2002
>>
>> Sure there is :-) time.mktime() can take a "malformed" time tuple and
>> do something sensible with it. You can therefore get a time tuple from
>> gmtime, add one to the day position and call time.mktime() on the
>> result:
>>
>> >>> x = (2002, 2, 29, 0, 31, 42, 2, 170, 0)
>> >>> time.gmtime(time.mktime(x))
>> (2002, 3, 1, 7, 31, 42, 4, 60, 0)
>> >>>
>
> Pure luck that this works. Don't complain if it stops workin in Python
> 2.7 and your code breaks ;-)
>
actually that is a function of the mktime() function in the C library which the
python module wraps. Based on my reading of a man page or two this behaviour
seems guaranteed by POSIX. Now, the assumption made is the mktime() function
on YOUR system follows POSIX.
More information about the Python-list
mailing list