formatDate()
The strLib.formatDate() system function formats a DATE value and
returns a STRING value. EGL tries the following formats for the conversion, in order. If a
particular format is null, empty, or not valid, EGL moves to the next:
- The format string provided as a parameter
- strLib.defaultDateFormat
- The date format in the Java™ locale object (Java™ only)
- The format "MM/dd/yyyy"
Syntax
strLib.formatDate(
dateValue DATE? in
[, dateFormat STRING? in])
returns (result STRING?)
- dateValue
- Input can be any variable or expression that is assignment compatible with the DATE type (see "Assignment compatibility in EGL").
- dateFormat
- Identifies the date format, as described in Date/time masks and format specifiers. You can use a literal, a string variable, or any of the date format constants described in EGL library strLib.
- result
- A STRING variable. If either parameter has a null value, the function returns a null value.
Example
myDate DATE = "20060606";
myFormat STRING = "EEE, MMM d, ''yy";
result STRING;
result = strLib.formatDate(myDate,myFormat);
// result is "Tue, Jun 6, '06"