As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.
Join the TIBCO Community TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.
From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
Request access to the private WebFOCUS User Group (login required) to network with fellow members.
Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.
OK, is it really this involved to simply change a date format to an alpha-10 with "mm/dd/yyyy" format? I simply need to write a text string representation of my date to a file with the above format.
Here's my current solution to this:
Without changing the master and using SQL Server as the source I start with a date/time field of HYYMDs. Example using a simple Define:
DEFINE FILE XYZ FDATE/MDYY = HDATE(MY_BIRTHDAY,'MDYY'); -* First convert date to mm/dd/yyy as date ALPHA_DATE/A8=DATECVT(ADATE,'MDYY','A8MDYY'); -* Next convert to alpha 8 as mmddyyyy ALPHA_DATE_FMT/A10 = EDIT(ALPHA_DATE,'99/99/9999'); -* Finally convert to alpha 10 using edit with mask END
TABLE FILE XYZ PRINT MY_BIRTHDAY/HYYMDs 'UNTOUCHED' FDATE/MDYY AS 'DATE_MM/DD/YYYY' ALPHA_DATE/A8 AS 'ALPHA8' ALPHA_DATE_FMT/A10 AS 'ALPHA10_MM/DD/YYYY' END
So I get: (fields are stacked for viewing) MY_BIRTHDAY 05/15/1974:00:00:00.000
DATE_MM/DD/YYYY 05/15/1974
ALPHA8 05151974
ALPHA10_MM/DD/YYYY 05/15/1974
Surely there's a better/quicker way to arrive at a text string date with "mm/dd/yyyy" format. Right?This message has been edited. Last edited by: Phil DeBusk,
Phil - You might want to look at the (almost) 1001 Ways to Work with Dates covering thru release 8.0.2 from Aviter, Inc.....nearly everything that you will ever need to know to manipulate dates is there.
VivianThis message has been edited. Last edited by: Vivian,
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
Phil, to convert a Date format field into an ALPHA with component demarcations in one step, use FPRINT. Note that FPRINT will also do a conversion from YYMD to MDYY.
TABLE FILE CAR
PRINT CAR
COMPUTE CURRENT_HMDYY/HYYMDs = HGETC(8,'HYYMDs');
COMPUTE CURRENT_ALPHA/A10 = FPRINT(CURRENT_HMDYY,'HMDYY','A10');
END
Check it by adding "ON TABLE SAVE" and reviewing the output. Then,look at the save.ftm and you'll see that CURRENT_ALPHA is indeed stored in ALPHA format with the component slashes.
Lastly, I do have an old version of the book but, FPRINT isn't covered. I don't know if it's covered in the latest version ... hmmm ... maybe I should write a book titled "(Just About) a Thousand different ways to use FPRINT"!
FPRINT function was added to WebFocus in release 7.7.01. The newest version of the "Dates" book does include FPRINT. It is not in the current version of the dates book, but thanks to a hint from Francis Mariani, I have added it to the next release (around Oct 2013).
a) REFSDATE/MDYY WITH SD_MDY1='04152006';
b) REFHMDYY/HMDYYS WITH SD_MDY1 = HGETC(8,REFHMDYY) ;
c) REFLDATE/A8MDYY WITH SD_MDY1 = '04152006 ;
d) REF_S01/A10 = FPRINT(REFSDATE,'M.D.YY', 'A10');
e) REF_S02/A16 = FPRINT(REFSDATE,'MtrDYY', 'A16');
f) REF_S03/A24 = FPRINT(REFSDATE,'MtrDwrYY', 'A24');
g) REF_S04/A30 = FPRINT(REFHMDYY,'HMDYYS', 'A30');
h) REF_S05/A30 = FPRINT(REFHMDYY,'HYYMDS', 'A30');
i) REF_S06/A30 = FPRINT(REFHMDYY,'HYYMTdS', 'A30');
j) REF_S07/A30 = FPRINT(REFHMDYY,'HYYMTDs', 'A30');
k) REF_S08/A16 = FPRINT(REFLDATE,'A8MTDYY', 'A16');
l) REF_S09/A16 = FPRINT(REFLDATE,'A8MtDYY', 'A16');
Results
(a) Base Smart Date = 04/15/2006
(b) Base DateTime = 06/03/2013 19:46:21
(c) Legacy Base Date = 04/15/2006
1 1 2 2 3
out-format ....5....0....5....0....5....0
(d) M.D.YY = 04.15.2006
(e) MtrDYY = April 15, 2006
(f) MtrDwrYY = April 15 2006, Saturday
(g) HMDYYS = 06/03/2013 19:46:21
(h) HYYMDS = 2013/06/03 19:46:21
(i) HYYMTdS = 2013 June 3 19:46:21
(j) HYYMTDs = 2013 June 03 19:46:21.299
(k) MTDYY = APR 15 2006
(l) MtDYY = APR 15 2006
WebFOCUS 8.0.2, FOCUS since 1977 - John@Aviter.com PDF , Excel, FOCUS, Author of the Keysheets and Dates book. www.Aviter.com
That's good news John. Thanks! The book is truly useful. I have the first printing of the 2nd edition, dated 2006 so, it's probably time to get the "newest" version when it comes out in October.
BTW, FPRINT was added to official cannon in 7.7.01 but was added to 7.6.x as an undocumented feature...not sure which version it was added to but it works in our 7.6.11 environment.
In FOCUS since 1985 - WF 8.009/8.104 Win 8 Outputs: ALL of 'em! Adapters: Sql Server Teradata Oracle