This is a preview version of the DisplayLink DL-7450 Software Development Kit Documentation. The functionality that is described and made available in this version is subject to addition, removal or change without warning.

class time – Represent a time

A representation of a time, assuming that every day is composed of 24 hours, each hour composed of 60 minutes, and each minute composed of 60 seconds.

N.B. time objects have no notion of “leap seconds”.

time objects support equality and comparison operators.

class datetime.time(hour=0, minute=0, second=0, microsecond=0, tzinfo=None, *, fold=0)

Construct a time object representing a given hour, minute, second and microsecond. The arguments are as follows:

  • hour, minute, second and microsecond are integers in the given ranges:

    • 0 <= hour < 24

    • 0 <= minute < 60

    • 0 <= second < 60

    • 0 <= microsecond < 1000000

    Each of these arguments will default to 0 if omitted.

  • tzinfo is a datetime.tzinfo object, allowing a time to be associated with a particular timezone. If this is not desired, the tzinfo can be None.

  • fold is a value of either 0 or 1 used to disambiguate wall times during a repeated interval. A repeated interval occurs when clocks are rolled back at the end of daylight saving time, or when the UTC offset for the current zone is decreased for political reasons. The values 0 and 1 represent, respectively, the earlier and later of the two moments with the same wall time representation.

classmethod fromisoformat(time_string)

Construct a time object from a string in ISO 8601 format:

from datetime import time
t = time.fromisoformat('07:55:27.999999')
min

The earliest representable time, time(0, 0, 0, 0).

max

The latest representable time, time(23, 59, 59, 999999).

resolution

The smallest possible difference between non-equal time objects, timedelta(microseconds=1).

hour

The hour of the time, an integer in the range 0 to 23.

minute

The minute of the time, an integer in the range 0 to 59.

second

The second of the time, an integer in the range 0 to 59.

microsecond

The microsecond of the time, an integer in the range 0 to 999999.

tzinfo

The datetime.tzinfo object associated with the time, or None if no timezone information is associated with the time.

fold

Used to disambiguate wall times during a repeated interval. The values 0 and 1 represent, respectively, the earlier and later of the two moments with the same wall time representation.

replace(hour=self.hour, minute=self.minute, second=self.second, microsecond=self.microsecond, tzinfo=self.tzinfo, *, fold=0)

Return a new time object with the same values as the existing time object, but with the specified parameters updated.

isoformat(timespec='auto')

Return a string representing the time in ISO 8601 format.

By default, this will output time in the format HH-MM-SS (or HH-MM-SS.ssssss if microsecond is not 0). The optional timespec argument can be used to specify the number of digits to include in the output string:

  • 'hours': HH

  • 'minutes': HH:MM

  • 'seconds': HH:MM:SS

  • 'milliseconds': HH:MM:SS.sss

  • 'microseconds': HH:MM:SS.ssssss

tuple()

Return the time as a 6-tuple (hour, minute, second, microsecond, tzinfo, fold).

dst()

Return the daylight savings time offset as a datetime.timedelta object, or None if the time has no associated timezone.

tzname()

Return the name of the timezone as a string, or None if the time has no associated timezone.

utcoffset()

Return the UTC offset as a datetime.timedelta object, or None if the time has no associated timezone.