Focal Point
[SOLVED] converting an alpha value to a date

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

October 09, 2009, 02:07 PM
JohnB
[SOLVED] converting an alpha value to a date
What is a simple, concise way to convert an alpha field with date values into a date field? The dates values are in the following format with no leading zero on the day number: 1-Aug or 23-Aug. Rather than coding the logic to do it the "long" way (parsing the value, adding the leading zero, etc.), I would prefer something concise. The year can be obtained from a variable.

Thank you,

John

This message has been edited. Last edited by: JohnB,


WF 7.7.03, Windows 7, HTML, Excel, PDF
October 09, 2009, 02:16 PM
Tom Flynn
If it's not here, then, it's the long way...


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
October 09, 2009, 02:37 PM
JohnB
Thanks, Tom. I had checked the documentation before posting this. I was hoping someone had done this before and could provide an example of either one expression with nested functions or just a few defined fields to accomplish this.


WF 7.7.03, Windows 7, HTML, Excel, PDF
October 10, 2009, 03:07 PM
Danny-SRL
John,

This worked for me:
  
-SET &JB='1 Aug 2009';
DEFINE FILE CAR
DT/DMYY='&JB';
END
TABLE FILE CAR
PRINT DT BY COUNTRY
END

So, if your "date" is '1-Aug' and the year comes from somewhere else, I suggest you replace the hyphen with a space and concatenate the year and you should be home.


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF