Period.of_iso_duration#

static Period.of_iso_duration(iso_8601_duration)[source]#

Return a Period from a strict ISO 8601 duration string

Parameters:

iso_8601_duration (str) – An ISO 8601 duration string such as “P1Y” or “PT15M”. Does not accept “+offset” format.

Return type:

Period

Returns:

A Period object defined by the supplied ISO 8601 duration string

Raises:

PeriodParsingError – If the string does not contain a valid ISO 8601 duration value.