dhp.tempus package

Module contents

dhp.tempus - date, time and interval related routines.

exception dhp.tempus.IntervalError

Bases: exceptions.ValueError

time interval error has occurred


convert an interval ‘NwNdNhNmNs’ to a timedelta.

Parameters:interval (str) – a string in the form [Mw][Nd][Od][Ph][Qm][Rs]
Returns:a timedelta object of the same interval length.
Return type:datetime.timedelta

convert a timedelta to an interval.

Parameters:tdelta (datetime.timedelta) – The timedelta object to convert to an interval.
Returns:interval – The interval representation of the timedelta object.
Return type:str