Where allowed to run:
|
Parameters Examples Error messages |
Retrieve and Convert Date - Help
The RTVDATE command allows you to retrieve a date in a user-specified date format. Most formats are supported, including just about any combination of Y, M and D on the RTNFMT (return format) parameter.
Use this command to retrieve a date, such as today's date or to convert a date to another format. For example, to retrieve tomorrow's date and have that date returned to your CL program in YYYYMMDD format:
RTVDATE RTNDATE(&TOM) RTNFMT(*YYMD) DATE(*TOMORROW)
This will return tomorrow's date in YYYYMMDD format to the CL variable specified on the RTNDATE parameter.
Top |
Keyword | Description | Choices | Notes |
---|---|---|---|
RTNDATE | CL variable for returned date | Not restricted | Required, Positional 1 |
RTNFMT | Format of returned date | Character value, *JOB, *MDY, *DMY, *YMD, *JUL, *MDYY, *DMYY, *YYMD, *CYMD, *ISO, *USA, *EUR, *JIS, *LONGJUL, *JDEJUL, *DDMMMYY, *DDMMMYYYY, *CL, *DATETIME, *DTS, *DTSTEXT, *MDYTEXT, *DAY, *LONGDAY, *ISO0, *USA0 | Optional, Positional 2 |
DATE | Date to retrieve | Element list | Optional, Positional 3 |
Element 1: Date or symbolic date value | Date, *JOB, *JOBSTART, *JOBSBMDATE, *RUNDATE, *SYSVAL, *YESTERDAY, *TOMORROW, *CURRENT, *SYSTEM, *TODAY, *BOM, *EOM, *MONTHSTR, *MONTHEND | ||
Element 2: Time or symbolic time value | Time, *CURRENT | ||
WHEN | Adjust date WHEN | Single values: *NONE Other values: Element list |
Optional, Positional 4 |
Element 1: Returned Date is | *ALL, *SUN, *MON, *TUE, *WED, *THU, *FRI, *SAT, *WEEKDAY, *WEEKEND, *BOM, *EOM, *MONTHSTR, *MONTHEND | ||
Element 2: Then return the | *THIS, *NEXT, *PRV, *PREV, *FIRST, *LAST, 1, 2, 3, 4, 5, *BOM, *EOM, *MONTHSTR, *MONTHEND | ||
Element 3: Relative Day | *SUN, *MON, *TUE, *WED, *THU, *FRI, *SAT, *DAY, *WEEKDAY, *BOM, *EOM, *MONTHSTR, *MONTHEND | ||
DUR | Add duration to returned date | Single values: *NONE Other values: Element list |
Optional, Positional 5 |
Element 1: Duration | Integer | ||
Element 2: Duration code | *DAYS, *MONTHS, *YEARS, *DAY, *MONTH, *YEAR, *D, *M, *Y |
Top |
Specify a CL return variable to receive the date value. The format and length of this varibable is interpreted at runtime by the COZTOOLS system. The date value it converted into the same TYPE and LEN specified on the CL variable DCL statement and returned to the program. Therefore any valid *CHAR or *DEC CL variable may be specified.
Top |
Specify the format of the date as it should be returned to the CL variable specified on the RTNDATE parameter. The following special formats are provided for easy selection, however any combination of the CEEDATM API's date and time picture format codes may be used, including: For Date values: YY, YYYY, MM, MMM, DD, WWW, Mmm, Www, Wwwwwwwwwz, Mmmmmmmmmz, etc. For Time values: HH, MI, and SS to indicate hours, minutes and seconds. The letters AM and PM may also be used. See the CEEDATM API for a list of valid format combinations.
Top |
Specify the date to be returned to the RTNDATE parameter. The date specified here is converted to the format on the RTNFMT parameter. The DATE parameter consists of the date and time.
Date Value: Specify a date in job-date format to convert to the format specifed on the RTNFMT parameter. The following special value may be used instead of an actual date value:
Time Value to return. Specify any valid Time in HHMMSS or HH:MM:SS format. The time is returned when the RTNFMT parameter contains time-element formatting characters.
Top |
Use this parameter when the original date being returned needs to be adjusted for example, when it falls on a weekend, the end of month or a specific day of the week. The returned date is modified based on the values specified for this parameter.
Specify a day of week, symbolic date or *ALL to adjust the returned date when this returned date is this value.
Specify a relative operator for the new returned date value. This element is used with the Relative Day element to adjust the date being returned.
Specify a day of the week or one of of the symbolic dates to be returned when the original returned date WHEN condition is meet. This element is used with the "Then Return" element to produce the date being returned. The following values are allowed:
Top |
Specify a numeric value that is added as a duration to the date specified on the DATE portion of the DATE parameter. This parameter consists of two parts:
For the DURATION portion, specify the quantity of the duration. The following special value is allowed for the DURATION:
*NONE - No duration is added to the date before it is returned.
(+/-)99999 - The number of days or months or years to add to the date before it is returned. Specify a positive or negative value.
For the DURATION CODE portion, specify the context of the duration. The following values are allowed for the DURATION CODE portion:
Top |
Top |
Top |