Class: QgsDateRange¶
- class qgis.core.QgsDateRange(begin: Union[QDate, datetime.date], end: Union[QDate, datetime.date], includeBeginning: bool = True, includeEnd: bool = True)¶
Bases:
sip.wrapper
Constructor for
QgsTemporalRange
. Thebegin
andend
are specified, and optionally whether or not these bounds are included in the range.Note
in Python
begin
andend
must be provided.QgsDateRange(
QgsDateRange
)QgsRange
which stores a range of dates.Invalid QDates as the beginning or end are permitted. In this case, the bound is considered to be infinite. E.g. QgsDateRange(QDate(),QDate(2017,1,1)) is treated as a range containing all dates before 2017-1-1. QgsDateRange(QDate(2017,1,1),QDate()) is treated as a range containing all dates after 2017-1-1.
See also
New in version 3.0:
Methods
Returns the beginning of the range.
Returns
True
if this range contains another range.Returns the upper bound of the range.
Extends the range in place by extending this range out to include an
other
range.Returns
True
if the beginning is inclusive, orFalse
if the beginning is exclusive.Returns
True
if the end is inclusive, orFalse
if the end is exclusive.Returns
True
if the range is empty, ie the beginning equals (or exceeds) the end and either of the bounds are exclusive.Returns
True
if the range consists of all possible values.Returns
True
if the range consists only of a single instant.Returns
True
if this range overlaps another range.- begin(self) QDate ¶
Returns the beginning of the range.
See also
See also
- Return type
QDate
- contains(self, other: QgsDateRange) bool ¶
Returns
True
if this range contains another range.contains(self, element: Union[QDate, datetime.date]) -> bool Returns
True
if this range contains a specifiedelement
.- Parameters
other (QgsDateRange) –
- Return type
bool
- end(self) QDate ¶
Returns the upper bound of the range.
See also
See also
- Return type
QDate
- extend(self, other: QgsDateRange) bool ¶
Extends the range in place by extending this range out to include an
other
range. Ifother
is empty the range is not changed. If the range is empty andother
is not, the range is changed and set toother
.See also
- Return type
bool
- Returns
True
if the range was extended
New in version 3.12.
- Parameters
other (QgsDateRange) –
- includeBeginning(self) bool ¶
Returns
True
if the beginning is inclusive, orFalse
if the beginning is exclusive.See also
See also
- Return type
bool
- includeEnd(self) bool ¶
Returns
True
if the end is inclusive, orFalse
if the end is exclusive.See also
See also
- Return type
bool
- 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.- Return type
bool
- isInfinite(self) bool ¶
Returns
True
if the range consists of all possible values.See also
See also
- Return type
bool
- isInstant(self) bool ¶
Returns
True
if the range consists only of a single instant.See also
See also
- Return type
bool
- overlaps(self, other: QgsDateRange) bool ¶
Returns
True
if this range overlaps another range.- Parameters
other (QgsDateRange) –
- Return type
bool