Class: QgsInterval¶
-
class
qgis.core.
QgsInterval
¶ Bases:
sip.wrapper
Default constructor for QgsInterval. Creates an invalid interval.
QgsInterval(seconds: float) Constructor for QgsInterval.
- Parameters
seconds – duration of interval in seconds
QgsInterval(QgsInterval)
A representation of the interval between two datetime values.
New in version 2.16: Enums
Methods
Returns the interval duration in days.
Converts a string to an interval
Returns the interval duration in hours.
Returns
True
if the interval is valid.Returns the interval duration in minutes.
Returns the interval duration in months (based on a 30 day month).
Returns the interval duration in seconds.
Sets the interval duration in days.
Sets the interval duration in hours.
Sets the interval duration in minutes.
Sets the interval duration in months.
Sets the interval duration in seconds.
Sets whether the interval is valid.
Sets the interval duration in weeks.
Sets the interval duration in years.
Returns the interval duration in weeks.
Returns the interval duration in years (based on an average year length)
Signals
Attributes
-
DAY
= 86400¶
-
HOUR
= 3600¶
-
MINUTE
= 60¶
-
MONTHS
= 2592000¶
-
WEEKS
= 604800¶
-
YEARS
= 31557600¶
-
fromString
(string: str) → QgsInterval¶ Converts a string to an interval
- Parameters
string – string to parse
- Returns
interval, or invalid interval if string could not be parsed
-
hours
(self) → float¶ Returns the interval duration in hours.
See also
-
isValid
(self) → bool¶ Returns
True
if the interval is valid.See also
-
minutes
(self) → float¶ Returns the interval duration in minutes.
See also
-
months
(self) → float¶ Returns the interval duration in months (based on a 30 day month).
See also
-
seconds
(self) → float¶ Returns the interval duration in seconds.
See also
-
setDays
(self, days: float)¶ Sets the interval duration in days.
- Parameters
days – duration in days
See also
-
setHours
(self, hours: float)¶ Sets the interval duration in hours.
- Parameters
hours – duration in hours
See also
-
setMinutes
(self, minutes: float)¶ Sets the interval duration in minutes.
- Parameters
minutes – duration in minutes
See also
-
setMonths
(self, months: float)¶ Sets the interval duration in months.
- Parameters
months – duration in months (based on a 30 day month)
See also
-
setSeconds
(self, seconds: float)¶ Sets the interval duration in seconds.
- Parameters
seconds – duration in seconds
See also
-
setValid
(self, valid: bool)¶ Sets whether the interval is valid.
- Parameters
valid – set to
True
to set the interval as valid.
See also
-
setWeeks
(self, weeks: float)¶ Sets the interval duration in weeks.
- Parameters
weeks – duration in weeks
See also
-
setYears
(self, years: float)¶ Sets the interval duration in years.
- Parameters
years – duration in years (based on average year length)
See also
-
weeks
(self) → float¶ Returns the interval duration in weeks.
See also
-
years
(self) → float¶ Returns the interval duration in years (based on an average year length)
See also