DateInterval

DateInterval.py

Convert interval strings (in the form of 1w2d, etc) to seconds, and back again. Is not exactly about months or years (leap years in particular).

Accepts (y)ear, (b)month, (w)eek, (d)ay, (h)our, (m)inute, (s)econd.

Exports only timeEncode and timeDecode functions.

MiscUtils.DateInterval.timeDecode(s)

Decode a number in the format 1h4d3m (1 hour, 3 days, 3 minutes).

Decode the format into a number of seconds.

MiscUtils.DateInterval.timeEncode(seconds)

Encode a number of seconds (representing a time interval).

Encode the number into a form like 2d1h3s.