Time arithmetic operation in Query for iSeries
Times can be subtracted, incremented, or decremented. The result of subtracting one time (TIME2) from
another (TIME1) is a time duration that specifies the number of hours, minutes, and seconds between the
two times.
For example, the result of TIME(
’11:02:26’
) − (
’10:32:56’
) is 2930; a duration of 0 hours, 29 minutes,
and 30 seconds.
Incrementing and decrementing times in Query for iSeries
The result of adding or subtracting a duration from time is itself a time. If a duration of hours is added or
subtracted, only the hours portion of the time is affected. The minutes and seconds remain unchanged. If
a duration of minutes is added or subtracted, only the minutes and hours if necessary are affected. Adding
or subtracting a duration of seconds affects the seconds portion and possibly the minutes and hours.
Timestamp arithmetic operation in Query for iSeries
Timestamps can be subtracted, incremented, or decremented. The result of adding or subtracting a
duration from a timestamp is a timestamp. Date and time arithmetic is the same as previously defined,
except that an overflow or underflow of hours is carried into the date portion of the result.
Durations in Query for iSeries
A
duration
represents a length of time. There are four types: labeled, date, time, and timestamp.
Labeled duration in Query for iSeries
A labeled duration represents a specific unit of time expressed as a number followed by one of the
following duration keywords:
YEAR, YEARS
MONTH, MONTHS
DAY, DAYS
HOUR, HOURS
MINUTE, MINUTES
SECOND, SECONDS
MICROSECOND, MICROSECONDS
A labeled duration can only be used as an operand if the other operand is of type date, time or timestamp.
For example:
HI 2 14 DAYS
is a valid expression.
HI (2 14 DAYS)
is not a valid expression. In both expressions, the labeled durations are 2 MONTHS and 14 DAYS.
Date duration in Query for iSeries
A date duration represents years, months, and days expressed as a DECIMAL (8,0) number. To be
properly interpreted, the number must have the format
yyyymmdd
where
yyyy
represents the number of
years,
mm
the number of months, and
dd
the number of days. The result of subtracting one date value
from another, as in the expression HIREDATE — BIRTHDATE, is a date duration. Example:
HIREDATE - BIRTHDATE
Time duration in Query for iSeries
A time duration represents hours, minutes and seconds expressed as a DECIMAL (6,0) number. To be
properly interpreted , the number must have the format
hhmmss
where
hh
represents the number of
hours,
mm
the number of minutes, and
ss
the number of seconds. The result of subtracting one time value
from another is a time duration.
Chapter 5. Defining result fields in Query for iSeries
73
Содержание @server iSeries
Страница 1: ...iSeries Query for iSeries Use Version 5 SC41 5210 04 ERserver ...
Страница 2: ......
Страница 3: ...iSeries Query for iSeries Use Version 5 SC41 5210 04 ERserver ...
Страница 12: ...x Query for iSeries Use V5R2 ...
Страница 14: ...2 Query for iSeries Use V5R2 ...
Страница 18: ...Figure 3 Major Tasks on the Query Menu and the Work with Queries Display 6 Query for iSeries Use V5R2 ...
Страница 32: ...20 Query for iSeries Use V5R2 ...
Страница 38: ...26 Query for iSeries Use V5R2 ...
Страница 44: ...32 Query for iSeries Use V5R2 ...
Страница 116: ...104 Query for iSeries Use V5R2 ...
Страница 122: ...110 Query for iSeries Use V5R2 ...
Страница 146: ...134 Query for iSeries Use V5R2 ...
Страница 150: ...138 Query for iSeries Use V5R2 ...
Страница 174: ...162 Query for iSeries Use V5R2 ...
Страница 178: ...166 Query for iSeries Use V5R2 ...
Страница 196: ...184 Query for iSeries Use V5R2 ...
Страница 198: ...186 Query for iSeries Use V5R2 ...
Страница 204: ...192 Query for iSeries Use V5R2 ...
Страница 205: ...Part 4 Appendixes Copyright IBM Corp 2000 2002 193 ...
Страница 206: ...194 Query for iSeries Use V5R2 ...
Страница 210: ...198 Query for iSeries Use V5R2 ...
Страница 242: ...230 Query for iSeries Use V5R2 ...
Страница 256: ...244 Query for iSeries Use V5R2 ...
Страница 270: ...258 Query for iSeries Use V5R2 ...
Страница 272: ...260 Query for iSeries Use V5R2 ...
Страница 292: ...280 Query for iSeries Use V5R2 ...
Страница 293: ......
Страница 294: ... Printed in U S A SC41 5210 04 ...