Progress
Language Reference
DATE Function
Converts a single character string, month, day, and year values, or an integer into a date.
SYNTAX
month
A constant, field name, variable name, or expression whose value is an integer from 1 to 12, inclusive.
day
An expression whose value is an integer from 1 to the highest valid day of the month.
year
An expression whose value is the year (for example, 1994).
string
A character string containing a date value to convert into a DATE data type. The string value must have the format specified by the Date Format (-d) startup parameter (the default is mdy). Note that -d sets the display format, not the date storage format, which is fixed. Furthermore, date constants entered in procedures, or as initial values in the Data Dictionary, are always specified in month/day/year format.
You do not have to specify separator characters for the month, day, and year components of the date string; however, slashes(/), periods(.), and hyphens(-) are accepted as separator characters.
integer-expression
An expression that evaluates to an integer value that represents the number of days since the origin of the 4GL date data type. Usually this integer is obtained from a previous operation where the date was converted to an integer using the INTEGER(4GL-date) function.
NOTE: The resulting date from the DATE(integer-expression) function is guaranteed to be a valid 4GL date only if the integer-expression originated from the INTEGER(4GL-date) function. EXAMPLEThis procedure reads data from an input file that contains date information from another system stored as character strings without slashes or dashes between month, day, and year. It tries to convert these dates to Progress dates. Some formats cannot be successfully converted.
The following example shows the DATE (string) syntax.
This example produces the following output. It produces no date for the first example since spaces are not a valid date separator:
SEE ALSO
DATE-FORMAT Attribute, DAY Function, MONTH Function, TODAY Function, WEEKDAY Function, YEAR Function, YEAR-OFFSET Attribute
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |