Class: QgsDateTimeRange¶
Stores a range of date times.
Invalid date times as the beginning or end are permitted. In this case, the bound is considered to be infinite. E.g.
# a range containing all dates before 2017-1-1
QgsDateTimeRange(QDateTime(),QDateTime(2017,1,1))
# a range containing all dates after 2017-1-1
QgsDateTimeRange(QDateTime(2017,1,1),QDateTime())
See also
Methods
Returns the beginning of the range. |
|
Returns |
|
Returns the upper bound of the range. |
|
Extends the range in place by extending this range out to include an other range. |
|
Returns |
|
Returns |
|
Returns |
|
Returns |
|
Returns |
|
Returns |
- class qgis.core.QgsDateTimeRange¶
Bases:
object- __init__(begin: QDateTime | datetime.datetime, end: QDateTime | datetime.datetime, includeBeginning: bool = True, includeEnd: bool = True)
Constructor for QgsDateTimeRange. The
beginandendare specified, and optionally whether or not these bounds are included in the range.- Parameters:
begin (Union[QDateTime, datetime.datetime])
end (Union[QDateTime, datetime.datetime])
includeBeginning (bool = True)
includeEnd (bool = True)
- __init__(QgsDateTimeRange)
Copy constructor.
- begin(self) QDateTime¶
Returns the beginning of the range.
See also
See also
- Return type:
QDateTime
- contains(self, other: QgsDateTimeRange) bool¶
Returns
Trueif this range contains another range.- Parameters:
other (
QgsDateTimeRange)- Return type:
bool
- contains(self, element: QDateTime | datetime.datetime) bool
Returns
Trueif this range contains a specifiedelement.- Parameters:
element (Union[QDateTime, datetime.datetime])
- Return type:
bool
- end(self) QDateTime¶
Returns the upper bound of the range.
See also
See also
- Return type:
QDateTime
- extend(self, other: QgsDateTimeRange) bool¶
Extends the range in place by extending this range out to include an
otherrange. Ifotheris empty the range is not changed. If the range is empty andotheris not, the range is changed and set toother.See also
- Return type:
bool
- Returns:
Trueif the range was extended
Added in version 3.12.
- Parameters:
other (QgsDateTimeRange)
- includeBeginning(self) bool¶
Returns
Trueif the beginning is inclusive, orFalseif the beginning is exclusive.See also
See also
- Return type:
bool
- includeEnd(self) bool¶
Returns
Trueif the end is inclusive, orFalseif the end is exclusive.See also
See also
- Return type:
bool
- isEmpty(self) bool¶
Returns
Trueif 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.- Return type:
bool
- isInfinite(self) bool¶
Returns
Trueif the range consists of all possible values.See also
See also
- Return type:
bool
- isInstant(self) bool¶
Returns
Trueif the range consists only of a single instant.See also
See also
- Return type:
bool
- overlaps(self, other: QgsDateTimeRange) bool¶
Returns
Trueif this range overlaps another range.See also
- Parameters:
other (QgsDateTimeRange)
- Return type:
bool