Tinderbox v9 Icon

Interval Data Type

Interval

A new attribute type, Interval, represents time intervals and durations. The default value is a string "00:00" representing zero minutes and zero seconds. Longer durations are available. For example, the interval value

01:30 

represents one minute and thirty seconds. The duration

01:01:00 

represents a duration of one hour, one minute, and thirty seconds.

Note that minute and second values do not need zero-padding, "4:2" and "04:02"

Negative values

An interval may have negative duration:

-5:30 

represents a negative duration of 5 minutes and 30 seconds. This can be useful when doing short duration date arithmetic (as below).

If $MyInterval is "5:30"

Use in Date arithmetic

Intervals may be added or subtracted from Date attributes. They may multiplied or divided by constants or numeric attributes, and may be compared for equality using == and != or for magnitude using < and >.

Note: subtracting two dates does not currently return an interval; rather, it returns the number of days between the two dates in accordance with pre-existing Date-type attribute behaviour.

The result of applying a binary operation where the left-hand side is a string and the right-hand side is an interval is a string. Thus adding an interval to a string:

"The answer is:" + $MyInterval returns a string.

Alternative syntax

Some alternative syntax is supported, including an 'h' suffix/separator for hours and 'd' for days. Thus the duration

1h30 

represents one hour and thirty minutes, whilst:

1 day 01:00:00 represents 25 hours

2d2h30 represents two days, two hours and 30 minutes

whilst:

2d5 

is treated as 2 days, 5 hours, as hours is the next smaller duration measure than days.

The 'd' marker is always resaved/displayed as 'day(s)':

2d5 is resaved as "2 days 05:00:00

1d5 is resaved as "1 day 05:00:00

Note that whilst 'm' and 's' suffixes are understood for minutes and seconds; the 's' is superfluous anyway as it is always the last segment if used. If a duration is entered as "3m20" Tinderbox will re-save the value in the default format of "03:20" so use of 'm' is deprecated. Thus a duration entered as follows wii be understood:

1h30m10s 

but it is treated as one hour, thirty minutes and 10 seconds but will be re-saved as:

1:30:10 

Duration components larger than a day (of 24 hours), e.g. moths or years, are not supported, though is is possible to use large day values:

62 days 01:30:10

representing an interval of over two months' duration.

The maximum length of an interval but it is not advised to exceed 1 year (365 days) and ideally uses intervals of a few days or less.

Note slight variations in accepted abbreviations compared to pre-existing Date-type attribute date arithmetic usage.

Sorting order

Increasing duration, so unset ("00:00") values list first.

Interval-type attributes

Listing of Interval-type system attributes.