XmlTime

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

Concrete xs:time builtin type.

Represents iso 8601 time format hh:mm:ss[Z|(+|-)hh:mm] with rich comparisons and hashing.

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

replace(hour=None, minute=None, second=None, microsecond=None, offset=True)[source]

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

Parameters
Return type

XmlTime

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

classmethod now(tz=None)[source]

Initialize from datetime.datetime.now()

Parameters

tz (Optional[timezone]) –

Return type

XmlTime

classmethod utcnow()[source]

Initialize from datetime.datetime.utcnow()

Return type

XmlTime

to_time()[source]

Return a datetime.time instance.

Return type

time

__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

__delattr__(*args)

Implement delattr(self, name).

Parameters

args (Any) –

__eq__(other)

Return self==value.

Parameters

other (Any) –

Return type

bool

__ge__(other)

Return self>=value.

Parameters

other (Any) –

Return type

bool

__gt__(other)

Return self>value.

Parameters

other (Any) –

Return type

bool

__hash__()

Return hash(self).

Return type

int

__le__(other)

Return self<=value.

Parameters

other (Any) –

Return type

bool

__lt__(other)

Return self<value.

Parameters

other (Any) –

Return type

bool

__ne__(other)

Return self!=value.

Parameters

other (Any) –

Return type

bool

__setattr__(*args)

Implement setattr(self, name, value).

Parameters

args (Any) –

as_dict()

Return arguments as dictionary.

Return type

dict