There has been quite a bit of changes to how dates are handled. I need to know a simple way or function for converting an alpha field to a date field.This message has been edited. Last edited by: MCKELPA99,
WebFOCUS 7.7.02 Unix All Output
February 15, 2012, 02:58 PM
Waz
What is the format of the alpha dates ?
Waz...
Prod:
WebFOCUS 7.6.10/8.1.04
Upgrade:
WebFOCUS 8.2.07
OS:
Linux
Outputs:
HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!
February 15, 2012, 03:05 PM
njsden
Well, you could start by taking a look at my favourite DATECVT function and play with it.
As Waz indicates, the "format" in which your date string is represented plays an important role into how the conversion can be done.
TABLE FILE CAR
PRINT CAR NOPRINT
COMPUTE DATE_STR/A10 = '20120214';
COMPUTE DATE_DT/YYMD = DATECVT(DATE_STR, 'A8YYMD', 'YYMD');
WHERE RECORDLIMIT EQ 1
END
The DATECVT function worked for me....thanks njsden. The format of the alpha date is A8 or A8MDYY (ex. '10/01/2009'). Actually, A8MDYY worked with the function.
WebFOCUS 7.7.02 Unix All Output
February 15, 2012, 04:57 PM
Waz
The other way to do this is:
TABLE FILE CAR
PRINT CAR NOPRINT
COMPUTE STR_DATE/A8MDYY = EDIT('10/01/2009','99$99$9999') ;
COMPUTE MY_DATE/MDYY = STR_DATE ;
WHERE RECORDLIMIT EQ 1
END