Date Time and Editing System Values


The system clock has two parts: a system date and a system time. Both parts are controlled by system values, and changing these system values takes effect immediately. All date and time system values are in character format.

System Date

The system date is contained in system value QDATE. The system date is subdivided into several different parts: day, month, year, day-of-week, and century. These values are contained in system values QDAY, QMONTH, QYEAR, QDAYOFWEEK, and QCENTURY, respectively. Two other system values are used to further describe the system date: QLEAPADJ and QDATFMT. System value QLEAPADJ can be used to "tweak" the way the system handles a leap year (not likely to be used unless you do not utilize the Gregorian Calendar), and the system value QDATFMT dictates in what order the year, month, and day components are used to put together QDATE.

If you live in the United States, you probably want to set QDATFMT to the value MDY. This causes May 3, 1999 to appear as 05/03/99. If you live in Mexico, however, QDATFMT should be set to DMY. The same date would then appear as 03/05/99. Other valid values are YMD (so the year appears first) and JUL (for pseudo-Julian dates, YYDDD, where YY is the year and DDD is a sequential number between 1 and 366).

One additional system value related to the system date is QDATSEP. Several options are available, and each one uses a different character as the separator. For example, if you put a value of ‘1’ in QDATSEP, the system date appears as 05/03/99. If you use ‘2’, it would appear as 05-03-99. You have three other choices: a period, a comma, or a blank space.

System Time

The system time is contained in system value QTIME. Like the system date, the system time also is subdivided into three parts: hours (QHOUR), minutes (QMINUTE), and seconds (QSECOND). System time differs from system date, however, in that no options are available for formatting the system time, because the format HHMMSS is used throughout the world. There is, however, a system value that controls what character is used to separate the subdivisions: QTIMSEP.

QTIMSEP has four options. For example, ‘1’ causes the system to use a colon (:), so noon appears as 12:00:00. You can also select a period, a comma, or a blank space.

Tip 

Because changing the date and time system values takes effect immediately, you can reset your system clock by changing the appropriate system value.

For example, when Daylight Savings Time begins, you can adjust the time by changing QHOUR. You do not have to change the whole system time (QTIME), just the hour:

      CHGSYSVAL SYSVAL(QHOUR) VALUE('07') 

This command changes the hour portion to 07. When Daylight Savings Time ends, you can change QHOUR again.

Editing System Values

In addition to QDATFMT, QDATSEP, and QTIMSEP, which edit dates and times, two other editing system values are available:

QCURSYM, which contains a single character that will be used as the currency symbol in application programs.

QDECFMT, which controls what character is used for the decimal mark. You can select between a blank (period for decimal, zero suppression), ‘I’ (comma for decimal, zero suppression), or ‘J’ (comma for decimal, one leading zero).



IBM i5/iSeries Primer(c) Concepts and Techniques for Programmers, Administrators, and Sys[... ]ators
IBM i5/iSeries Primer(c) Concepts and Techniques for Programmers, Administrators, and Sys[... ]ators
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 245

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