Subgroup: other

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: Methods

days Returns the interval duration in days.
fromString Converts a string to an interval
hours Returns the interval duration in hours.
isValid Returns true if the interval is valid.
minutes Returns the interval duration in minutes.
months Returns the interval duration in months (based on a 30 day month).
seconds Returns the interval duration in seconds.
setDays Sets the interval duration in days.
setHours Sets the interval duration in hours.
setMinutes Sets the interval duration in minutes.
setMonths Sets the interval duration in months.
setSeconds Sets the interval duration in seconds.
setValid Sets whether the interval is valid.
setWeeks Sets the interval duration in weeks.
setYears Sets the interval duration in years.
weeks Returns the interval duration in weeks.
years Returns the interval duration in years (based on an average year length)

Signals

Attributes

DAY
HOUR
MINUTE
MONTHS
WEEKS
YEARS
DAY = 86400
HOUR = 3600
MINUTE = 60
MONTHS = 2592000
WEEKS = 604800
YEARS = 31557600
days(self) → float

Returns the interval duration in days.

See also

setDays()

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

setHours()

isValid(self) → bool

Returns true if the interval is valid.

See also

setValid()

minutes(self) → float

Returns the interval duration in minutes.

See also

setMinutes()

months(self) → float

Returns the interval duration in months (based on a 30 day month).

See also

setMonths()

seconds(self) → float

Returns the interval duration in seconds.

See also

setSeconds()

setDays(self, days: float)

Sets the interval duration in days.

Parameters:days – duration in days

See also

days()

setHours(self, hours: float)

Sets the interval duration in hours.

Parameters:hours – duration in hours

See also

hours()

setMinutes(self, minutes: float)

Sets the interval duration in minutes.

Parameters:minutes – duration in minutes

See also

minutes()

setMonths(self, months: float)

Sets the interval duration in months.

Parameters:months – duration in months (based on a 30 day month)

See also

months()

setSeconds(self, seconds: float)

Sets the interval duration in seconds.

Parameters:seconds – duration in seconds

See also

seconds()

setValid(self, valid: bool)

Sets whether the interval is valid.

Parameters:valid – set to true to set the interval as valid.

See also

isValid()

setWeeks(self, weeks: float)

Sets the interval duration in weeks.

Parameters:weeks – duration in weeks

See also

weeks()

setYears(self, years: float)

Sets the interval duration in years.

Parameters:years – duration in years (based on average year length)

See also

years()

weeks(self) → float

Returns the interval duration in weeks.

See also

setWeeks()

years(self) → float

Returns the interval duration in years (based on an average year length)

See also

setYears()