# XmlTime

class xsdata.models.datatype.XmlTime(hour: int, minute: int, second: int, fractional_second: int = 0, offset: int | None = None)

  Concrete xs:time builtin type.

  Represents iso 8601 time format hh :mm: ss[Z|(+|-)hh:mm] with rich comparisons and hashing. :param hour: Unsigned integer between 0-24 :param minute: Unsigned integer between 0-59 :param second: Unsigned integer between 0-59 :param fractional_second: Unsigned integer between 0-999999999 :param offset: Signed integer representing timezone offset in

  > minutes

  hour: `int`

    Alias for field number 0

  minute: `int`

    Alias for field number 1

  second: `int`

    Alias for field number 2

  fractional_second: `int`

    Alias for field number 3

  offset: `Optional`[`int`]

    Alias for field number 4

  replace(hour=None, minute=None, second=None, fractional_second=None, offset=True)

    Return a new instance replacing the specified fields with new values.

    Return type:

      `XmlTime`

  classmethod from_string(string)

    Initialize from string format `%H:%M:%S%z`

    Return type:

      `XmlTime`

  classmethod from_time(obj)

    Initialize from `datetime.time` instance.

    Return type:

      `XmlTime`

  classmethod now(tz=None)

    Initialize from datetime.datetime.now()

    Return type:

      `XmlTime`

  classmethod utcnow()

    Initialize from datetime.now(timezone.utc)

    Return type:

      `XmlTime`

  to_time()

    Return a `datetime.time` instance.

    Return type:

      `time`

  __str__()

    Return the time formatted according to ISO 8601 for xml.

    Return type:

      `str`

    Examples:

      - 21:32:52

      - 21:32:52+02:00,

      - 19:32:52Z

      - 21:32:52.126789

      - 21:32:52.126Z

  __eq__(other)

    Return self==value.

    Return type:

      `bool`

  __ne__(other)

    Return self!=value.

    Return type:

      `bool`

  __lt__(other)

    Return self<value.

    Return type:

      `bool`

  __le__(other)

    Return self<=value.

    Return type:

      `bool`

  __gt__(other)

    Return self>value.

    Return type:

      `bool`

  __ge__(other)

    Return self>=value.

    Return type:

      `bool`

  __add__(value, /)

    Return self+value.

  __class_getitem__()

    See PEP 585

  __contains__(key, /)

    Return bool(key in self).

  __getattribute__(name, /)

    Return getattr(self, name).

  __getitem__(key, /)

    Return self[key].

  __getnewargs__()

    Return self as a plain tuple. Used by copy and pickle.

  __hash__()

    Return hash(self).

  __iter__()

    Implement iter(self).

  __len__()

    Return len(self).

  __mul__(value, /)

    Return self*value.

  __rmul__(value, /)

    Return value*self.

  count(value, /)

    Return number of occurrences of value.

  index(value, start=0, stop=9223372036854775807, /)

    Return first index of value.

    Raises ValueError if the value is not present.