Domain: Environment information (calendar)
The DATE-VALUE( ) function outputs the date which is a specified number of days from the base date (default value for this is 1900-01-01).
Format
DATE-VALUE( ) |
NUMBER-OF-DAYS = arithm_expression ,BASE = *STD / *TODAY / string_expression ,FORMAT = *ISO / *AMERICAN / *GERMAN |
Result type
STRING (<string 10..13>)
Input parameters
NUMBER-OF-DAYS = arithm_expression
Number of days from the base date.
BASE =
Designates the base date.
The format of this BASE value is independent of the value of the FORMAT operand.
It may be in the *ISO, *GERMAN or *AMERICAN format, with the day or month in one or two digit form (a leading zero is not required for the first 9 days or months), and with the year in two or four digit form. The BASE value can contain date with or without the number of days in the current year (the number of days must always be used with 3 digit number and must be correct relative to the rest of the date) and can be used in conjunction with the DATE() function. If the year is specified in two-digit form (these being the last two digits), the first two digits will be determined in the same way as for SDF data type ’date’:
Input year | First two digits |
00..59 | 20 |
60..99 | 19 |
BASE = *STD
The base date is 1900-01-01.
BASE = *TODAY
The base date is the current date.
BASE = string_expression
Specifies the base date.
The value is a date after 1582-10-15.
FORMAT = *ISO / *AMERICAN / *GERMAN
Defines the format in which the date is output.
Result
Input parameter FORMAT = | Date format <string 10..13> |
*AMERICAN | mm/dd/yyiii |
*ISO | yyyy-mm-ddiii |
*GERMAN | dd.mm.yyyy |
iii | Day in current year (001 .. 366)
|
Error message
SDP0452 INVALID DATE
Example
/A = DATE-VALUE(NUMBER-OF-DAYS = 23008, FORMAT = *ISO) /SHOW-VARIABLE A A = 1962-12-30364 /A = DATE-VALUE(NUMBER-OF-DAYS = 23008, FORMAT = *AMERICAN) /SHOW-VARIABLE A A = 12/30/62364 /A = DATE-VALUE(NUMBER-OF-DAYS = 23008, FORMAT = *GERMAN) /SHOW-VARIABLE A A = 30.12.1962 /A = DATE-VALUE(NUMBER-OF-DAYS = 1705, BASE = '04.01.2050004', FORMAT = *ISO) /SHOW-VARIABLE A A = 2054-09-05248 /AFTERTOMORROW = DATE-VALUE(NUMBER-OF-DAYS = 2, BASE = DATE( )) /TOMORROW = DATE-VALUE(NUMBER-OF-DAYS = 1, BASE = *TODAY) /TODAY = DATE( ) /SHOW-VARIABLE (TODAY,TOMORROW,AFTERTOMORROW) AFTERTOMORROW = 2024-07-17199 TODAY = 2024-07-15197 TOMORROW = 2024-07-16198