DATABASE TIME FORMAT AND SEPARATOR (Edit Character)


To specify the format for a time field, use the DDS TIMFMT keyword, as follows:

       TIMFMT( *JOB | *HMS | *ISO | *USA | *EUR | *JIS ) 

The DDS TIMFMT keyword accepts the time format codes specified in Table C.2.

The time format represents how the time is presented to the user. Time fields include a time separator. All time formats are eight characters in length.

To specify a separator other than the default separator, use the DDS keyword TIMSEP. The TIMSEP keyword accepts one parameter in the following format:

        TIMSEP( *JOB | 'time separator' ) 

The time separator parameter is a quoted character and is used to edit a time field where the format is *HMS. Any symbol listed under the column heading "Separator" in Table C.2 can be specified. For example, TIMSEP('.') causes the period to be used as the separator. Optionally, TIMSEP(*JOB) can be specified to indicate that the separator is based on the TIMSEP value of the OS/400 job that is running when the database file is created.

The TIMSEP keyword is valid only for time fields where the format is *HMS. The TIMSEP keyword cannot be specified for time formats other than *HMS.

Timestamp Format

The format of timestamp fields is fixed. It is a single-format data type that optionally includes microseconds. The format of the timestamp data type follows:

        CCYY-MM-DD-HH.MN.SS.MMMMMM 

When specifying a timestamp value, the microseconds part is optional. If microseconds aren't specified, they are automatically set to .000000 by the operation accessing the timestamp. The other parts of the timestamp value are required. The following example is a valid timestamp value as used in RPG III programs:

        '1995-06-21-15.00.00.000000' 

Note that the lowest valid timestamp value is as follows:

        '0001-01-01-00.00.00.000000 

Note

There is no way to retrieve microseconds within RPG IV. Currently, the TIME operation code retrieves, at best, milliseconds.




The Modern RPG IV Language
The Modern RPG IV Language
ISBN: 1583470646
EAN: 2147483647
Year: 2003
Pages: 156
Authors: Robert Cozzi

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net