Thanks. It means, you take a datetime object and then using a timedelta object, perform the addition, the language takes care of changing the date if the time crosses midnight. WOW... this makes life a lot easier..
Have a brilliant evening. Best Regards, Asrarahmed Kadri On 11/18/06, Kent Johnson <[EMAIL PROTECTED]> wrote:
Asrarahmed Kadri wrote: > Hi , > > > I have a question: > > Is it possible to add seconds to a datetime object and get the result as > a new datetime object. I mean when we keep adding, for example, 3600 > seconds, the date will get changed after 24 iterations. Is it possible > to carry out such an operation ? Sure, just add a datetime.timedelta to the datetime object: In [1]: from datetime import datetime, timedelta In [2]: d=datetime.now() In [3]: d Out[3]: datetime.datetime(2006, 11, 18, 9, 47, 31, 187000) In [4]: delta=timedelta(seconds=3600) In [5]: d+delta Out[5]: datetime.datetime(2006, 11, 18, 10, 47, 31, 187000) Kent
-- To HIM you shall return.
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor