A time object represents a (local) time of day, independent of any particular day, and subject to adjustment via a tzinfo object.
hour[, minute[, second[, microsecond[, tzinfo]]]]) |
None
, or
an instance of a tzinfo subclass. The remaining arguments
may be ints or longs, in the following ranges:
0 <= hour < 24
0 <= minute < 60
0 <= second < 60
0 <= microsecond < 1000000
.
If an argument outside those ranges is given,
ValueError is raised. All default to 0
except
tzinfo, which defaults to None.
Class attributes:
time(0, 0, 0, 0)
.
time(23, 59, 59, 999999)
.
timedelta(microseconds=1)
, although note that
arithmetic on time objects is not supported.
Instance attributes (read-only):
range(24)
.
range(60)
.
range(60)
.
range(1000000)
.
None
if none was passed.
Supported operations:
self.utcoffset()
).
In order to stop mixed-type comparisons from falling back to the
default comparison by object address, when a time object is
compared to an object of a different type, TypeError is
raised unless the comparison is ==
or !=
. The latter
cases return False or True, respectively.
0
if that's
None
), the result is non-zero.
Instance methods:
[hour[, minute[, second[, microsecond[, tzinfo]]]]]) |
tzinfo=None
can be specified to create a naive time from
an aware time, without conversion of the time members.
) |
None
, a 6-character
string is appended, giving the UTC offset in (signed) hours and
minutes:
HH:MM:SS.mmmmmm+HH:MM
or, if self.microsecond is 0,
HH:MM:SS+HH:MM
) |
str(t)
is equivalent to
t.isoformat()
.
format) |
) |
None
, returns None
, else
returns self.tzinfo.utcoffset(None)
, and
raises an exception if the latter doesn't return None
or
a timedelta object representing a whole number of minutes
with magnitude less than one day.
) |
None
, returns None
, else
returns self.tzinfo.dst(None)
, and
raises an exception if the latter doesn't return None
, or
a timedelta object representing a whole number of minutes
with magnitude less than one day.
) |
None
, returns None
, else
returns self.tzinfo.tzname(None)
, or
raises an exception if the latter doesn't return None
or
a string object.
See About this document... for information on suggesting changes.