XmlTime

class xsdata.models.datatype.XmlTime(hour, minute, second, microsecond=0, offset=None)[source]

Immutable structure for xs:time:

Format: hh:mm:ss[Z|(+|-)hh:mm]

Parameters
  • hour (int) – Unsigned integer between 0-24

  • minute (int) – Unsigned integer between 0-59

  • second (int) – Unsigned integer between 0-59

  • microsecond (int) – Unsigned integer between 0-999999

  • offset (Optional[int]) – Signed integer representing timezone offset in minutes

classmethod from_string(string)[source]

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

Parameters

string (str) –

Return type

XmlTime

classmethod from_time(obj)[source]

Initialize from datetime.time instance.

Parameters

obj (time) –

Return type

XmlTime

to_time()[source]

Return a datetime.time instance.

Return type

time

__eq__(other)[source]

Return self==value.

Parameters

other (Any) –

Return type

bool

__str__()[source]

Return the time formatted according to ISO 8601 for xml.

Examples:
  • 21:32:52

  • 21:32:52+02:00,

  • 19:32:52Z

  • 21:32:52.126789

  • 21:32:52.126Z

Return type

str