Focal Point
Convert date I8MDYY to A8MDYY

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

November 09, 2005, 07:30 AM
<Unfocused>
Convert date I8MDYY to A8MDYY
I'm having problems converting a I8MDYY to an A8MDYY. Red Face

I used the following technique to convert a date to an alpha (a blank date field is shown as the basedate 12/31/1900 in Excel with background coloured).

-* CPOST_DT is MDYY type
CTRL_I/I8=CPOST_DT;
CTRL_A/A8MDYY=CPOST_DT;
MM3/A2=EDIT(CTRL_A, '99');
DD3/A2=EDIT(CTRL_A, '$$99');
YYYY3/A4=EDIT(CTRL_A, '$$$$9999');
CTRL_AD/A10=IF CTRL_I EQ 0 THEN ' ' ELSE MM3|'/'|DD3|'/'|YYYY3;

But another date field to convert is I8MDYY and similar code for that type does not work. How can an I8MDYY be converted to an A8MDYY?

Thanks for any illumination.
Smiler
November 09, 2005, 08:40 AM
joan_c
try

CTRL_I/I8MDYY=CPOST_DT;
CTRL_A/A8MDYY=EDIT(CTRL_I);
November 09, 2005, 09:52 AM
<Unfocused>
thanks Joan. But it did not work.
The code
CTRL_I/I8=CPOST_DT;
CTRL_A/A8MDYY=CPOST_DT;
MM3/A2=EDIT(CTRL_A, '99');
DD3/A2=EDIT(CTRL_A, '$$99');
YYYY3/A4=EDIT(CTRL_A, '$$$$9999');
CTRL_AD/A10=IF CTRL_I EQ 0 THEN ' ' ELSE MM3|'/'|DD3|'/'|YYYY3;

works fine with CPOST_DT which is MDYY type.
But using similar code for field PEND_DT (which is I8MDYY type) does not-:

PEND_A/A8MDYY=PEND_DT;
MM4/A2=EDIT(PEND_A '99');
DD4/A2=EDIT(PEND_A,'$$99');
YYYY4/A4=EDIT(PEND_A, '$$$$9999');
PEND_AD/A10=IF PPOST_DT EQ 0 THEN ' ' ELSE MM4|'/'|DD4|'/'|YYYY4;

I want to convert the I8MDYY type to a MDYY type.
November 09, 2005, 11:54 AM
codermonkey
I got confused on what conversion you are trying to accomplish so I've posted an example with three difference types:

TABLE FILE CAR
PRINT COUNTRY
COMPUTE
-* I8MDYY TO A8MDYY
DTE_I8/I8MDYY = 11092005;
DTE_A8/A8MDYY = EDIT(DTE_I8);
-***************************
-* MDYY TO A8MDYY
DTE_SMART/MDYY = 11082005;
DTE_ALPHA/A8MDYY = DTE_SMART;
-***************************
-* I8MDYY TO MDYY
DTE_INT/I8MDYY = 11072005;
TEMP1/A8MDYY = EDIT(DTE_INT);
DTE_SMRT/MDYY = TEMP1;
-***************************
WHERE RECORDLIMIT EQ 1
END

Does this help?
November 10, 2005, 10:13 AM
<Unfocused>
thanks coder for the information, it's very useful.
November 19, 2005, 10:17 PM
Vivian
You should consider the book almost 1001 Ways to Work with Dates in WebFOCUS...It will answer your questions on almost every kind of date transformation and date calculation. Comes with CD with all code on it. Check it out.
Regards,
Vivian
Aviter, Inc.
http://www.aviter.com


Vivian Perlmutter
Aviter, Inc.


WebFOCUS Keysheet Rel. 8.0.2
(Almost) 1001 Ways to Work with Dates thru Rel. 8.0.2
Focus since 1982
WebFOCUS since the beginning
Vivian@aviter.com

November 21, 2005, 10:57 AM
Francis Mariani
If there are "almost 1001 Ways to Work with Dates in WebFOCUS", how many are there, exactly?


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
November 21, 2005, 07:08 PM
susannah
Big Grin




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
November 22, 2005, 08:30 AM
Tony A
I love the cover of the book! Palm trees with .... Dates!!



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10