[Tutor] time calc
dyoo at hkn.eecs.berkeley.edu
Fri Jun 18 14:25:12 EDT 2004
On Fri, 18 Jun 2004, kevin parks wrote:
> Anyone know if there is a module that does time math? or a method for
> doing this by hand?
Check the 'datetime' module:
'datetime' defines a bunch of types, including ones for doing date and
time arithmetic. For example:
>>> from datetime import timedelta
>>> t1 = timedelta(hours=1)
>>> t2 = timedelta(minutes=30)
>>> t1 + t2
Hope this helps!
More information about the Tutor