Studio supports two built-in types for time management:
Times are stored as the number of microseconds since Jan 1, 1970 (also known as UNIX epoch).
Intervals are stored as months, days, and microseconds.
The string representation of a time is ISO 8601 compliant. When converting a string into a time, Studio supports a somewhat relaxed subset of ISO 8601; even dates without separators are accepted. The accepted string formats match those of time literals.
'23:30' '23:30:23' '23:30:23.001023' '23:30:23.001023Z' '23:30:23.001023-05' '23:30:23.001023-3:30' '1995-02-03' '1995-02-03 23:30' '1995-02-03 23:30:23' '1995-02-03 23:30:23.001023' '1995-02-03 23:30:23.001023Z' '1995-02-03 23:30:23.001023-05' '1995-02-03 23:30:23.001023-3:30' '1995-02-03T23:30' '1995-02-03T23:30:23' '1995-02-03T23:30:23.001023' '1995-02-03T23:30:23.001023Z' '1995-02-03T23:30:23.001023-05' '1995-02-03T23:30:23.001023-3:30' '19950203T' '19950203T233023.001023-330'
Following ISO 8601, time zones are specified as offsets from UTC. Named time zones are not supported because there is no international standard for time zone abbreviations. If no time zone is specified in a time literal, the default time zone for the current locale is used.
Note that:
When a time is presented to a user, the format associated to the user’s locale is used. For custom time formatting, the format function can be used. For further information, please see Time Functions.
Intervals have two primary parts:
The calendar dependent component exists, so arithmetic between time and interval is consistent. When using a Gregorian calendar (the most common calendar in use), you cannot assume that a month equals to 30 days. In fact, you cannot even assume that a day lasts 24 hours.
The Gregorian calendar inserts two corrections:
display 'now' + '2M'
Interval literals are enclosed by single-quotes ('). They are formed by a sequence of fields, where each field is a number plus a unit suffix. The following table lists all valid suffixes:
All magnitudes can contain a '.' to express a fractional part, although the fractional part is dropped for days or months.
display '2MT2.5M' display '1Y1M3h2m1.500s' display '1.5h'
As mentioned before, time and intervals have some arithmetic rules.
The following table lists the behavior of addition and subtraction with time and interval:
For further information on Time and Interval, please refer to the following: