Time [ HP ALLBASE/BRW Reference Manual ] MPE/iX 5.0 Documentation
HP ALLBASE/BRW Reference Manual
Time
You can manipulate times using HP ALLBASE/BRW Time types. Items of type
Time are defined in the data dictionary. (See Chapter 18 for the
data dictionary definitions of Time types). A time always consists of
hours, minutes, and seconds. Time items can be output in many different
ways, depending on the edit-mask (for output) and the data dictionary
definition (for input). HP ALLBASE/BRW converts all times into packed
decimal numbers with 19 digits, including 6 decimal places. You specify
times using colons, as below:
8:24:37 <<8 o'clock, 24 minutes, 37 seconds>>
10:4 <<4 minutes past 10 o'clock>>
0:14:50 <<14 minutes and 50 seconds>>
00:00:00 or 0:0 <<midnight >>
23:59:59 <<one second before midnight>>
24:00 <<invalid>>
Time Operations
You can manipulate times using standard functions.
Time Extraction Functions
Time extraction functions extract parts of a time value and are specified
as shown here:
HOUR_OF (time)
MINUTES_OF (time)
SECOND_OF (time)
They result in integer-type items.
Time Duration Functions
Time duration functions calculate the difference between two time values.
These are specified as:
HOURS_DIFF (time1, time2)
MINUTES_DIFF (time1, time2)
SECONDS_DIFF (time1, time2)
They result in integer-type items.
If the duration is not an integral number of hours or minutes, the
difference is rounded to the nearest integral number.
Time AdditionFunctions
Time addition functions calculate a time value by adding hours, minutes
or seconds to a time value and are specified as:
ADD_HOURS (time1, time2)
ADD_MINUTES (time1, time2)
ADD_SECONDS (time1, time2)
They result in time-type items.
Time Subtraction Functions
Time subtraction functions calculate a time value by subtracting hours,
minutes, or seconds from a time value and are specified as:
SUB_HOURS (time1, time2)
SUB_MINUTES (time1, time2)
SUB_SECONDS (time1, time2)
They result in time-type items.
Note that out-of-range times are corrected automatically, for example:
ADD_MINUTES (23:55,10) results in 0:05
SUB_MINUTES (0:05,10) results in 23:55
MPE/iX 5.0 Documentation