XmlDuration

class xsdata.models.datatype.XmlDuration(value)[source]

Immutable string representation for xs:duration.

Format PnYnMnDTnHnMnS:
  • P: literal value that starts the expression

  • nY: the number of years followed by a literal Y

  • nM: the number of months followed by a literal M

  • nD: the number of days followed by a literal D

  • T: literal value that separates date and time parts

  • nH: the number of hours followed by a literal H

  • nM: the number of minutes followed by a literal M

  • nS: the number of seconds followed by a literal S

Parameters

value (str) – String representation of a xs:duration, eg P2Y6M5DT12H

property years

Number of years in the interval.

Return type

Optional[int]

property months

Number of months in the interval.

Return type

Optional[int]

property days

Number of days in the interval.

Return type

Optional[int]

property hours

Number of hours in the interval.

Return type

Optional[int]

property minutes

Number of minutes in the interval.

Return type

Optional[int]

property seconds

Number of seconds in the interval.

Return type

Optional[float]

property negative

Negative flag of the interval.

Return type

bool