EDIT2: Converting a Numeric, Date, or Date-Time Value to a Character String

How to:

The EDIT2 function converts a numeric, date, or date-time value to a character string based on a specified format. The format must be valid for the data supplied. The output is returned as variable length alphanumeric.

Syntax: How to Convert a Numeric, Date, or Date_Time Value to a Character String

EDIT2(in_value, 'format')

where:

in_value

Numeric, date, or date-time

Is any numeric value or a date in either standard date or date-time format. If the date is given in standard date format, all of its time components are assumed to be zero.

'format'

Is a numeric, date, or date-time format enclosed in single quotation marks.

Example: Converting a Date to a Character String

The following request defines a date field as YYMD format and converts it to a character string (CharDate) in YYMtrD format.

DEFINE FILE WF_RETAIL_LITE
DATE1/YYMD = TIME_DATE_DAY_COMPONENT;
CharDate/A20 = EDIT2(DATE1,'YYMtrD');
END
TABLE FILE WF_RETAIL_LITE
SUM COGS_US
BY CharDate
WHERE TIME_MTHNAME  EQ 'FEB'
ON TABLE SET PAGE NOLEAD
END

The output is shown in the following image.

WebFOCUS

Feedback