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.
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)
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 (str) – string to parse
- Return type
- Returns
interval, or invalid interval if string could not be parsed
-
hours
(self) → float¶ Returns the interval duration in hours.
See also
- Return type
float
-
isValid
(self) → bool¶ Returns true if the interval is valid.
See also
- Return type
bool
-
minutes
(self) → float¶ Returns the interval duration in minutes.
See also
- Return type
float
-
months
(self) → float¶ Returns the interval duration in months (based on a 30 day month).
See also
- Return type
float
-
seconds
(self) → float¶ Returns the interval duration in seconds.
See also
- Return type
float
-
setDays
(self, days: float)¶ Sets the interval duration in days.
- Parameters
days (float) – duration in days
See also
-
setHours
(self, hours: float)¶ Sets the interval duration in hours.
- Parameters
hours (float) – duration in hours
See also
-
setMinutes
(self, minutes: float)¶ Sets the interval duration in minutes.
- Parameters
minutes (float) – duration in minutes
See also
-
setMonths
(self, months: float)¶ Sets the interval duration in months.
- Parameters
months (float) – duration in months (based on a 30 day month)
See also
-
setSeconds
(self, seconds: float)¶ Sets the interval duration in seconds.
- Parameters
seconds (float) – duration in seconds
See also
-
setValid
(self, valid: bool)¶ Sets whether the interval is valid.
- Parameters
valid (bool) – set to true to set the interval as valid.
See also
-
setWeeks
(self, weeks: float)¶ Sets the interval duration in weeks.
- Parameters
weeks (float) – duration in weeks
See also
-
setYears
(self, years: float)¶ Sets the interval duration in years.
- Parameters
years (float) – duration in years (based on average year length)
See also
-
weeks
(self) → float¶ Returns the interval duration in weeks.
See also
- Return type
float
-
years
(self) → float¶ Returns the interval duration in years (based on an average year length)
See also
- Return type
float