konrad.utils.parse_fraction_of_day

konrad.utils.parse_fraction_of_day(time)[source]

Calculate the fraction of a day.

Parameters

time (str, float, or timedelta) –

Specified time delta (e.g. ‘6h’). Valid units:

  • ’s’ for seconds

  • ’m’ for minutes

  • ’h’ for hours

  • ’d’ for days

  • ’w’ for weeks

If numeric, return value.

Returns

datetime.timedelta – Object representing the time span.

Example

>>> parse_fraction_of_day('12h')
datetime.timedelta(seconds=43200)