Home | Forums

Interval Format

The interval type is used to specify a period of time. It consists of a value and a unit specifier, eg. "3 days". The Interval type is very flexible about how it interprets the time unit. In general, the first letter is sufficient to indicate the interval unit. For example, the previous example could be written as "3 d". The time ranges supported are specified in the following table

Unit specifier Abbrev. Example Values
second s 3 seconds 20s
minute m 5 minute 7 min, 11m
hour h 4 hours 2h
day d 7 days 365d
week w 4 weeks 10w
month mo 5.6 months 24mo
year y 100 years 5y

If no time unit is provided the default unit of "days" is used. A numeric value must always be provided or an exception will be thrown. Numeric values may be fractional (eg. 5.6).

Due to the variable lengths of months and years, approximations are used for these values within Clover. A month is considered to be 30.346 days and a year is considered to be 365.232 days. All other units are exact.