Time fields have a predetermined size and format. They can be defined on the definition specification. Leading and trailing zeros are required for all time data.
Time constants or variables used in comparisons or assignments do not have to be in the same format or use the same separators. Also, times used for I/O operations such as input fields, output fields or key fields are also converted (if required) to the necessary format for the operation.
The default internal format for time variables is *ISO. This default internal format can be overridden globally by the control specification keyword TIMFMT, temporarily changed by /SET and /RESTORE directives, and individually set by the definition specification keyword TIME or TIMFMT.
RPG Format Name | Description | Format (Default Separator) | Valid Separators | Length | Example |
---|---|---|---|---|---|
*HMS | Hours:Minutes:Seconds | hh:mm:ss | : . , & | 8 | 14:00:00 |
*ISO | International Standards Organization | hh.mm.ss | . | 8 | 14.00.00 |
*USA | IBM® USA Standard. AM and PM can be any mix of upper and lower case. | hh:mm AM or hh:mm PM | : | 8 | 02:00 PM |
*EUR | IBM European Standard | hh.mm.ss | . | 8 | 14.00.00 |
*JIS | Japanese Industrial Standard Christian Era | hh:mm:ss | : | 8 | 14:00:00 |
RPG Format Name | Description | *LOVAL | *HIVAL | Default Value |
---|---|---|---|---|
*HMS | Hours:Minutes:Seconds | 00:00:00 | 24:00:00 | 00:00:00 |
*ISO | International Standards Organization | 00.00.00 | 24.00.00 | 00.00.00 |
*USA | IBM USA Standard. AM and PM can be any mix of upper and lower case. | 00:00 AM | 12:00 AM | 00:00 AM |
*EUR | IBM European Standard | 00.00.00 | 24.00.00 | 00.00.00 |
*JIS | Japanese Industrial Standard Christian Era | 00:00:00 | 24:00:00 | 00:00:00 |