November 10th, 2008

DAY HOUR MINUTE SECOND Data, Part 2 of 2

Posted by admin in F. Data Types

If precision is specified, it shows the number of positions in the field:

INTERVAL HOUR(2)                     Means 2 digits for the hour.
                                     This is also the default length for HOUR
                                     if precision is omitted.
INTERVAL SECOND(5,3)                 Means 5 digits for the second
                                     and 3 digits for the fractional second.
                                     6 is the default fractional precision of second
                                     if the fractionalprecision is omitted.
INTERVAL DAY(5) TO MINUTE            Means 5 digits for DAY,
                                     and values of HOUR and MINUTE.
INTERVAL MINUTE(5) TO SECOND(4)      Means 5 digits for MINUTE and 4 digits for SECOND.
INTERVAL '21:17:7.2' 21 hours,       17 minutes,7.2 seconds.
INTERVAL '21:17:7.2' HOUR TO SECOND  21 hours, 17 minutes, 7.2 seconds.

Changing a time with an INTERVAL:

NewTime = DueTime + INTERVAL '30' MINUTE

Finding the number of hours between two times:

TimeLate = (TimePaid - DueTime) HOUR

A time can have it’s time zone specified:

TIME '15:45:30'                         AT LOCAL (AT LOCAL means that
                                        this time is in the local time zone.)
INTERVAL '10' DAY + INTERVAL '15' DAY   Gives an interval of '25' days.

Comments are closed.

Sorry, the comment form is closed at this time.