Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  iWay Software Product Forum on Focal Point    [SOLVED] Date conversion help
Go
New
Search
Notify
Tools
Reply
  
[SOLVED] Date conversion help
 Login/Join
 
Member
posted
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
VS

This message has been edited. Last edited by: <Kathryn Henning>,


WebFOCUS8,IWAY DM
Windows, All Outputs
 
Posts: 9 | Registered: July 29, 2014Reply With QuoteReport This Post
Virtuoso
posted Hide Post
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.

I would use:
DEFINE ALPHA_FINISH/A6DMY= EDIT(GETTOK(INPUT,50,-1,' ',8,'A8'),'99$99$99');
DEFINE YYMD_FINISH/YYMD DEFCENT 19 YRTHRESH 52  = ALPHA_FINISH;

to get the correct century.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Reply With QuoteReport This Post
Master
posted Hide Post
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,


WebFOCUS 7.7.05 Windows, Linux, DB2, IBM Lotus Notes, Firebird, Lotus Symphony/OpenOffice. Outputs PDF, Excel 2007 (for OpenOffice integration), WP
 
Posts: 674 | Location: Guelph, Ontario, Canada ... In Focus since 1985 | Registered: September 28, 2010Reply With QuoteReport This Post
Member
posted Hide Post
thanks , both methods are working ..

Regards
VS


WebFOCUS8,IWAY DM
Windows, All Outputs
 
Posts: 9 | Registered: July 29, 2014Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  iWay Software Product Forum on Focal Point    [SOLVED] Date conversion help

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.