TimeStampInterval Type

The TimeStampInterval primitive type is used to represent the difference between two TimeStamp values. The null value for timestamp interval is equivalent to a timestamp interval of zero duration.

The following example shows a timestamp interval established by subtracting two timestamps. This example also shows the use of methods to display the number of whole days in an interval and the remaining time in milliseconds.

vars
    time     : Time;
    date     : Date;
    ts1, ts2 : TimeStamp;
    interval : TimeStampInterval;
begin
    date.setDate(31,12,2007);       // New Year's Eve
    time.setTime(23,59,0,0);        // Minute before midnight
    ts1.setDate(date);
    ts1.setTime(time);
    date.setDate(1,1,2008);         // New Year's Day
    time.setTime(12,0,0,0);         // Noon
    ts2.setDate(date);
    ts2.setTime(time);
    interval := ts2 - ts1;
    write interval;                 // 0:12:01:00.000 (days:hours:mins:secs)
    write interval.getMilliseconds; // 43260000 milliseconds
end;

The following table lists valid operations for the TimeStampInterval primitive type.

Expression Expression Type
timestamp-expression - timestamp-expression (timestampinterval)
timestamp-expression + or - timestampinterval-expression (timestamp)
timestampinterval-expression * or / integer-expression (timestampinterval)
timestampinterval-expression + or - timestampinterval-expression (timestampinterval)
timestampinterval-expression < or <= or = or >= or > or <> timestampinterval-expression (boolean)

The TimeStampInterval value that results from subtracting two timestamp values does not take daylight saving into account.

For details about the methods defined in the TimeStampInterval primitive type, see "TimeStampInterval Methods", in the following subsection. For details about converting primitive types, see "Converting Primitive Types", in Chapter 1 of the JADE Developer’s Reference.