DATE AND TIME FORMAT CODES


Date, time, and timestamp (DTS) values can be converted from character, numeric, or literal format to a valid date, time, or timestamp variable using the MOVE and MOVEL operations. In addition, character and numeric variables can be checked for valid date, time, or timestamp values using the TEST operation.

When moving a DTS variable's value to a non-DTS variable, factor 1 of the MOVE or MOVEL operations indicate the format of the result field's value. When moving a non-DTS value to a DTS variable, factor 1 of the MOVE and MOVEL operations indicates the format of the value in factor 2. Table 5.4 lists the supported date formats for these operations. For more information, see the definition of the MOVE operation in chapter 1.

Table 5.4: Date Format Codes

Date Format

Description

Output Format

Separator

Length

Sample

*JOBRUN

Job runtime format

varies

*JOB

Job start date

N/A

INZ(*JOB)

*SYS

Current system date

N/A

INZ(*SYS)

*MDY

Month, Day, Year

mm/dd/yy

/ - . , &

8

02/17/95

*DMY

Day, Month, Year

dd/mm/yy

/ - . , &

8

17/02/95

*YMD

Year, Month, Day

yy/mm/dd

/ - . , &

8

95/02/17

*CYMD

Century, Year, Month, Day

cyy/mm/dd

/ - . , &

9

095/02/17

*CMDY

Century, Month, Day, Year

cmm/dd/yy

/ - . , &

9

002/17/95

*CDMY

Century, Day, Month, Year

cdd/mm/yy

/ - . , &

9

017/02/95

*JUL

Julian (year, day of year 1 – 365)

yy/ddd

/ - . , &

6

95/048

*LONGJUL

Long Julian

yyyy/ddd

8

1999/048

*ISO

International Standards Organization

ccyy-mm-dd

- (fixed)

10

1995-02-17

*USA

IBM's USA Standard

mm/dd/ccyy

/ (fixed)

10

02/17/1995

*EUR

IBM's European Standard

dd.mm.ccyy

(fixed)

10

17.02.1995

*JIS

Japanese Industrial Standard

ccyy-mm-dd

- (fixed)

10

1995-02-17

Although all date formats accept a separator character, only *MDY, *YMD, *DMY, *CMDY, *CYMD, and *CDMY date formats support various separators. In addition, a separator of 0 (zero) indicates that no separator is used and may be used with any date format.

Most time formats are similar. The only notable exception is the *USA format that is based on a 12-hour clock and includes AM/PM notation. Table 5.5 lists the time formats supported by the MOVE, MOVEL, and TEST operations.

Table 5.5: Time Format Codes

Time Format

Description

Output Format

Separator

Length

Sample

*JOBRUN

Job runtime format

Varies

*JOB

Job start time

N/A

INZ(*JOB)

*SYS

System time

N/A

INZ(*SYS)

*HMS

Hours, Minutes, Seconds

hh:mm:ss

: . , &

8

15:30:00

*ISO

International Standards Organization

hh.mm.ss

(fixed)

8

15.30.00

*USA

IBM's USA Standard

Hh:mm am

hh:mm pm

: (fixed)

8

03:30 pm

*EUR

IBM's European Standard

hh.mm.ss

(fixed)

8

15.30.00

*JIS

Japanese Industrial Standard

hh:mm:ss

: (fixed)

8

15:30:00

Timestamp Format

The format of a timestamp field is fixed. It is a single-format data type that optionally includes microseconds. Timestamp variables occupy 26 bytes. The format of the timestamp data type follows:

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

The format of the timestamp data type is the combination of the *ISO date format, the *ISO time format, and a 6-position microseconds entry. Note that only milliseconds are supported within the RPG IV language.




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