Focal Point
[SOLVED] to convert back to MDYY format

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/5367093036

April 24, 2013, 11:37 AM
serenekk
[SOLVED] to convert back to MDYY format
I have this working to calculate to get beginning of the week as End date fr my query to end depending on today's date and
last tuesday as Begining date.

-SET &WKDAY=DOWK(&YYMD,'A3');

-SET &BGN_DATE = DATECVT((DATEMOV((DATECVT(&YYMD,'I8YYMD','YYMD')),'BOW')),'YYMD','I8YYMD') - 6;
-SET &END_DATE = DATECVT((DATEMOV((DATECVT(&YYMD,'I8YYMD','YYMD')),'BOW')),'YYMD','I8YYMD');

NOW those 2 dates are in YYMD format. How do convert back to MDYY format? I kept getting 0 for the HDATE ..or should I use DATECVT? I kept getting errors using either one. Any help on this is much appreciated!

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


on VMS: OpenVMS AXP V8.2 Prod and TestEnvironment
Webfocus: WebFocus 7.6.1 Prod and TestEnvironment
April 24, 2013, 11:39 AM
Mike Deluca
-SET &DISPLAYDATE = EDIT(DATECVT(DATEADD(DATECVT(&BGN_DATE,'I8YYMD','YYMD'),'D',0),'YYMD','I8MDYY'),'99/99/9999');


Prod/Dev: WebFOCUS 8.0.06 on Windows Server 2008/Tomcat , WebFOCUS DevStudio 8.0.06 on Windows 7
April 24, 2013, 01:27 PM
serenekk
got it! many thanks!


on VMS: OpenVMS AXP V8.2 Prod and TestEnvironment
Webfocus: WebFocus 7.6.1 Prod and TestEnvironment
April 25, 2013, 04:25 AM
Alan B
quote:
-SET &BGN_DATE = DATECVT((DATEMOV((DATECVT(&YYMD,'I8YYMD','YYMD')),'BOW')),'YYMD','I8YYMD') - 6;

You are going to hit a problems when you run over the end of the month, as this will fail. Try:
SET TESTDATE = 20130507
-RUN
-SET &BGN_DATE = DATECVT((DATEMOV((DATECVT(&YYMD,'I8YYMD','YYMD')),'BOW')),'YYMD','I8YYMD') - 6;
-SET &DISPLAYDATE = EDIT(DATECVT(DATEADD(DATECVT(&BGN_DATE,'I8YYMD','YYMD'),'D',0),'YYMD','I8MDYY'),'99/99/9999');
-TYPE &DISPLAYDATE 


You will have to use DATEADD to move back 6 days. I much prefer to ignore the DATECVT and &YYMD type approaches and use functions throughout when in Dialogue Manager:
-SET &MDYY_END      = HCNVRT(HDTTM(DATEMOV(HDATE(HGETC(8,'HYYMDs'),'YYMD'),'BOW'),8,'HMDYYS'),'(HMDYY)',10,'A10') ;
-SET &MDYY_BGN      = HCNVRT(HDTTM(DATEADD(DATEMOV(HDATE(HGETC(8,'HYYMDs'),'YYMD'),'BOW'),'D',-6),8,'HMDYYS'),'(HMDYY)',10,'A10') ;
-TYPE &MDYY_END
-TYPE &MDYY_BGN



Alan.
WF 7.705/8.007