Blooming Together_ Growing a Community Garden Worksheet.docx
as400 built in function- %HOURS
1. %HOURS (Number of Hours)
%HOURS converts a number into a duration that can be added to a time or timestamp value to affect its
no. of hours.
Example
Columns . . . :
6 80
Brow
AMITCC/QRPGLESRC
SEU==>
BIN_HOURS
FMT D DName+++++++++++ETDsFrom+++To/L+++IDc.Keywords+++++++++++++++++++++++++++++
*************** Beginning of data ****************************************************
0001.00 DTIME0
S
T
INZ(T'10.12.15')
130201
0002.00 DTIME1
S
T
130201
0003.00 DTIMESTP0
S
Z
130201
0004.00 DTIMESTP1
S
Z
130201
0005.00 C
EVAL
TIME1=TIME0 + %HOURS(2)
130201
0006.00 C
TIME0
DSPLY
130201
0007.00 C
TIME1
DSPLY
130201
0008.00 C
TIME
TIMESTP0
130201
0009.00 C
EVAL
TIMESTP1=TIMESTP0 - %HOURS(2)
130201
0010.00 C
TIMESTP0
DSPLY
130201
0011.00 C
TIMESTP1
DSPLY
130201
0012.00 C
SETON
LR
130201
****************** End of data *******************************************************
OUTPUT
10.12.15
12.12.15
2013-02-01-01.45.25.661000
2013-01-31-23.45.25.661000