class xsdata.models.datatype.XmlPeriod(value)[source]#

Concrete xs:gYear/Month/Day builtin type.

Represents iso 8601 period formats with rich comparisons and hashing.

  • xs:gDay: —%d%z

  • xs:gMonth: –%m%z

  • xs:gYear: %Y%z

  • xs:gMonthDay: –%m-%d%z

  • xs:gYearMonth: %Y-%m%z


value (str) – String representation of a xs:period, eg –11-01Z

property year: int | None#

Period year.

property month: int | None#

Period month.

property day: int | None#

Period day.

property offset: int | None#

Period timezone offset in minutes.


Return date units as dict.

Return type:



Return self==value.

Return type:



Return self>=value.


Return self>value.

__hash__ = None#

Return self<=value.


Return self<value.


Return str(self).

classmethod __subclasshook__(C)#

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

count(value) integer -- return number of occurrences of value#
index(value[, start[, stop]]) integer -- return first index of value.#

Raises ValueError if the value is not present.

Supporting start and stop arguments is optional, but recommended.


Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.