QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
A representation of the interval between two datetime values. More...
#include <qgsinterval.h>
Public Member Functions | |
QgsInterval ()=default | |
Default constructor for QgsInterval. More... | |
QgsInterval (double duration, QgsUnitTypes::TemporalUnit unit) | |
Constructor for QgsInterval, using the specified duration and units. More... | |
QgsInterval (double seconds) | |
Constructor for QgsInterval. More... | |
QgsInterval (double years, double months, double weeks, double days, double hours, double minutes, double seconds) | |
Constructor for QgsInterval, using the specified years, months, weeks, days, hours, minutes and seconds. More... | |
double | days () const |
Returns the interval duration in days. More... | |
double | hours () const |
Returns the interval duration in hours. More... | |
bool | isValid () const |
Returns true if the interval is valid. More... | |
double | minutes () const |
Returns the interval duration in minutes. More... | |
double | months () const |
Returns the interval duration in months (based on a 30 day month). More... | |
operator QVariant () const | |
Allows direct construction of QVariants from intervals. More... | |
bool | operator== (QgsInterval other) const |
double | seconds () const |
Returns the interval duration in seconds. More... | |
void | setDays (double days) |
Sets the interval duration in days. More... | |
void | setHours (double hours) |
Sets the interval duration in hours. More... | |
void | setMinutes (double minutes) |
Sets the interval duration in minutes. More... | |
void | setMonths (double months) |
Sets the interval duration in months. More... | |
void | setSeconds (double seconds) |
Sets the interval duration in seconds. More... | |
void | setValid (bool valid) |
Sets whether the interval is valid. More... | |
void | setWeeks (double weeks) |
Sets the interval duration in weeks. More... | |
void | setYears (double years) |
Sets the interval duration in years. More... | |
double | weeks () const |
Returns the interval duration in weeks. More... | |
double | years () const |
Returns the interval duration in years (based on an average year length) More... | |
Static Public Member Functions | |
static QgsInterval | fromString (const QString &string) |
Converts a string to an interval. More... | |
Static Public Attributes | |
static const int | DAY = 60 * 60 * 24 |
Seconds per day. More... | |
static const int | HOUR = 60 * 60 |
Seconds per hour. More... | |
static const int | MINUTE = 60 |
Seconds per minute. More... | |
static const int | MONTHS = 60 * 60 * 24 * 30 |
Seconds per month, based on 30 day month. More... | |
static const int | WEEKS = 60 * 60 * 24 * 7 |
Seconds per week. More... | |
static const int | YEARS = 31557600 |
Seconds per year (average) More... | |
A representation of the interval between two datetime values.
Definition at line 40 of file qgsinterval.h.
|
default |
Default constructor for QgsInterval.
Creates an invalid interval.
QgsInterval::QgsInterval | ( | double | seconds | ) |
Constructor for QgsInterval.
seconds | duration of interval in seconds |
Definition at line 31 of file qgsinterval.cpp.
QgsInterval::QgsInterval | ( | double | duration, |
QgsUnitTypes::TemporalUnit | unit | ||
) |
Constructor for QgsInterval, using the specified duration and units.
Definition at line 36 of file qgsinterval.cpp.
QgsInterval::QgsInterval | ( | double | years, |
double | months, | ||
double | weeks, | ||
double | days, | ||
double | hours, | ||
double | minutes, | ||
double | seconds | ||
) |
Constructor for QgsInterval, using the specified years, months, weeks, days, hours, minutes and seconds.
Definition at line 43 of file qgsinterval.cpp.
|
inline |
Returns the interval duration in days.
Definition at line 129 of file qgsinterval.h.
|
static |
Converts a string to an interval.
string | string to parse |
Definition at line 66 of file qgsinterval.cpp.
|
inline |
Returns the interval duration in hours.
Definition at line 142 of file qgsinterval.h.
|
inline |
Returns true
if the interval is valid.
Definition at line 181 of file qgsinterval.h.
|
inline |
Returns the interval duration in minutes.
Definition at line 155 of file qgsinterval.h.
|
inline |
Returns the interval duration in months (based on a 30 day month).
Definition at line 103 of file qgsinterval.h.
|
inline |
Allows direct construction of QVariants from intervals.
Definition at line 200 of file qgsinterval.h.
bool QgsInterval::operator== | ( | QgsInterval | other | ) | const |
Definition at line 56 of file qgsinterval.cpp.
|
inline |
Returns the interval duration in seconds.
Definition at line 168 of file qgsinterval.h.
|
inline |
Sets the interval duration in days.
days | duration in days |
Definition at line 136 of file qgsinterval.h.
|
inline |
Sets the interval duration in hours.
hours | duration in hours |
Definition at line 149 of file qgsinterval.h.
|
inline |
Sets the interval duration in minutes.
minutes | duration in minutes |
Definition at line 162 of file qgsinterval.h.
|
inline |
Sets the interval duration in months.
months | duration in months (based on a 30 day month) |
Definition at line 110 of file qgsinterval.h.
|
inline |
Sets the interval duration in seconds.
seconds | duration in seconds |
Definition at line 175 of file qgsinterval.h.
|
inline |
Sets whether the interval is valid.
valid | set to true to set the interval as valid. |
Definition at line 188 of file qgsinterval.h.
|
inline |
Sets the interval duration in weeks.
weeks | duration in weeks |
Definition at line 123 of file qgsinterval.h.
|
inline |
Sets the interval duration in years.
years | duration in years (based on average year length) |
Definition at line 97 of file qgsinterval.h.
|
inline |
Returns the interval duration in weeks.
Definition at line 116 of file qgsinterval.h.
|
inline |
Returns the interval duration in years (based on an average year length)
Definition at line 90 of file qgsinterval.h.
|
static |
Seconds per day.
Definition at line 53 of file qgsinterval.h.
|
static |
Seconds per hour.
Definition at line 55 of file qgsinterval.h.
|
static |
Seconds per minute.
Definition at line 57 of file qgsinterval.h.
|
static |
Seconds per month, based on 30 day month.
Definition at line 49 of file qgsinterval.h.
|
static |
Seconds per week.
Definition at line 51 of file qgsinterval.h.
|
static |
Seconds per year (average)
Definition at line 47 of file qgsinterval.h.