Help- Trying to suppress the zeros for the day and Month.
WebFocus's date formats attach a leading 0 for days (i.e. 1 thru 9) or months (1 thru 9). If I don't want these leading zeros how do I suppress them? For example, instead of 01/01/2008, I want 1/1/2008. Thanks a million
August 12, 2008, 02:16 PM
Carol Dobson
What a shame that you have to tear apart a smart date, this should do it, but now you loose all the functionality of the smart dates!
Lastly, please update your signiture so we can better help you.
Thank you.
WebFOCUS 7.6.6/TomCat/Win2k3
August 12, 2008, 02:37 PM
Francis Mariani
Unfortunately, this doesn't do it.
DEFINE FILE CAR
DATE/MDYY = 01012008 ;
ADATE/A8MDYY = DATE;
MONTH/A2 = EDIT(ADATE,'99$$$$$$');
IMONTH/I2S=EDIT(MONTH);
DAY/A2=EDIT(ADATE,'$$99$$$$');
IDAY/I2S = EDIT(DAY);
YEAR/A4 = EDIT(ADATE,'$$$$9999');
IYEAR/I4=EDIT(YEAR);
YOURDATE/A10 = EDIT(IMONTH) | '/' | EDIT(IDAY) | '/' |EDIT(IYEAR);
END
TABLE FILE CAR
PRINT
COUNTRY
DATE
YOURDATE
END
You still get the leading zeros because the S (zero suppress) in I2S is ignored when using EDIT - EDIT(IMONTH).This message has been edited. Last edited by: Francis Mariani,
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
FTOA converts the numeric field to alpha, respecting the zero suppress. YOURDATEX is here to illustrate my puzzlement as to why the hard concatenation doesn't work with FMONTH and FDAY without the STRIP function.
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
August 12, 2008, 03:00 PM
Carol Dobson
You're right Francis, thanks for the correction in the ugly code! Brings back the old days coding memories.
I'd vote to keep the leading zeros and smart date format myself.