Hi , I need to convert an alphanumeric 'Sat 02/03/13' to a YYMD Date format.
I have tried DEFINE NEW_FINISH/DMY=DATECVT(EDIT(GETTOK(FINISH,50,-1,' ',50,'A50'),'99$99$99'),'A6DMY','DMY');
with above I could able to convert it to DMY date format however from DMY to YYMD its transalting as 1913/03/02 , I need 2013/03/02. how can I achieve this ? seems Y2K issue. Regards VSThis message has been edited. Last edited by: <Kathryn Henning>,
WebFOCUS8,IWAY DM Windows, All Outputs
October 11, 2014, 06:00 AM
Alan B
There are 2 parameters for setting the century, often referred to as the sliding window technique. These are DEFCENT and YRTHRESH. Any value below YRTHRESH has century set to DEFCENT+1.
Alan's version is probably cleaner. But there are several ways - here's another one. (You could just use the edit once to strip of the 'Sat ' and then CHGDAT to change the display order, for example.) I haven't used GETTOK in a long time and it's nice to be reminded that it exists.
(If you have dates going back to the previous century you'll have to make adjustments of course. The DEFCENT and YRTHRESH are one way of checking if a date belongs in that last century or this one - but of course you can do the same with IF ... ELSE statements).
quote:
'Sat 02/03/13'
DEFINE FILE CAR
OLDDATE/A12='Sat 02/03/13';
NEWDATE1/A8='20' | EDIT(OLDDATE, '$$$$$$$$$$99') | EDIT(OLDDATE, '$$$$$$$99$$$') | EDIT(OLDDATE, '$$$$99$$$$$$$$');
NEWDATE2/YYMD=DATECVT(NEWDATE1, 'A8YYMD', 'YYMD');
END
TABLE FILE CAR
PRINT NEWDATE1
NEWDATE2
BY CAR NOPRINT
BY OLDDATE
WHERE RECORDLIMIT EQ 1
END
This message has been edited. Last edited by: George Patton,