DATE AND TIME DURATION CODES


The date and time duration operations EXTRCT, ADDDUR, and SUBDUR and the built-in functions %DIFF and %SUBDT allow you to specify the duration code or extraction value. For example, you can subtract one date to control whether the return value is the number of days between the two dates, the number of months between the two dates, and so on. Table 5.6 lists the available duration codes.

Table 5.6: Duration Codes

Description of Duration

Duration Code

Short Form

Years

*YEARS

*Y

Months

*MONTHS

*M

Days

*DAYS

*D

Hours

*HOURS

*H

Minutes

*MINUTES

*MN

Seconds

*SECONDS

*S

Microseconds

*MSECONDS

*MS

Use one of these duration codes in factor 2 along with the corresponding duration value for the ADDDUR, SUBDUR, and EXTRCT operations. For additional information on the SUBDUR operation code, see the subheading SUBDUR (Subtract Duration).

Note that the MOVE and MOVEL operations don't use duration codes; they use date format codes. For more information, see Tables 5.4 and 5.5.

The duration code tells the compiler what type of code to generate for the ADDDUR, SUBDUR, and EXTRCT date operations. For example, when the number 30 is specified in factor 2 of the ADDDUR operation, the compiler needs to know whether that number represents 30 days, 30 minutes, 30 hours, or 30 years. If the date is July 23, 1996, adding one month to the date results in a date of August 23, 1996. If the date is July 31, 1996, adding one month to it results in a date of August 30, 1996.

There is no duration code for the century. This is an oversight. For date variables that include century, however, the *YEARS and *Y duration codes work with a four-digit year. This four-digit "year" includes the century in the first two positions.




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