Subgroup: Date

Class: QgsDateTimeRange

class qgis.core.QgsDateTimeRange(begin: Union[QDateTime, datetime.datetime], end: Union[QDateTime, datetime.datetime], includeBeginning: bool = True, includeEnd: bool = True)

Bases: sip.wrapper

Constructor for QgsTemporalRange. The begin and end are specified, and optionally whether or not these bounds are included in the range.

Note

in Python begin and end must be provided.

QgsDateTimeRange(QgsDateTimeRange)

QgsRange which stores a range of date times.

Invalid QDateTimes as the beginning or end are permitted. In this case, the bound is considered to be infinite. E.g. QgsDateTimeRange(QDateTime(),QDateTime(2017,1,1)) is treated as a range containing all dates before 2017-1-1. QgsDateTimeRange(QDateTime(2017,1,1),QDateTime()) is treated as a range containing all dates after 2017-1-1.

See also

QgsDateRange

New in version 3.0: Methods

begin Returns the beginning of the range.
contains Returns true if this range contains another range.
end Returns the upper bound of the range.
includeBeginning Returns true if the beginning is inclusive, or false if the beginning is exclusive.
includeEnd Returns true if the end is inclusive, or false if the end is exclusive.
isEmpty Returns true if the range is empty, ie the beginning equals (or exceeds) the end and either of the bounds are exclusive.
isInfinite Returns true if the range consists of all possible values.
isInstant Returns true if the range consists only of a single instant.
overlaps Returns true if this range overlaps another range.

Signals

Attributes

begin(self) → QDateTime

Returns the beginning of the range.

See also

end()

contains(self, other: QgsDateTimeRange) → bool

Returns true if this range contains another range.

contains(self, element: Union[QDateTime, datetime.datetime]) -> bool Returns true if this range contains a specified element.

end(self) → QDateTime

Returns the upper bound of the range.

See also

begin()

See also

includeEnd()

includeBeginning(self) → bool

Returns true if the beginning is inclusive, or false if the beginning is exclusive.

See also

begin()

See also

includeEnd()

includeEnd(self) → bool

Returns true if the end is inclusive, or false if the end is exclusive.

See also

end()

isEmpty(self) → bool

Returns true if the range is empty, ie the beginning equals (or exceeds) the end and either of the bounds are exclusive. A range with both invalid beginning and end is considered infinite and not empty.

isInfinite(self) → bool

Returns true if the range consists of all possible values.

See also

isEmpty()

See also

isInstant()

isInstant(self) → bool

Returns true if the range consists only of a single instant.

See also

isEmpty()

See also

isInfinite()

overlaps(self, other: QgsDateTimeRange) → bool

Returns true if this range overlaps another range.