Focal Point Banner


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.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] How to convert the date format to String

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] How to convert the date format to String
 Login/Join
 
Gold member
posted
Hi All,

I am having below requirement.

In one of my table,one of my column is having date format like 'May 30, 2013'.

I need to add 6 months to this date after that i need to append the string to this column. I am trying like below.

COMPUTE FREQUENCYDATA2/MDtrYY =DATEADD('May 30, 2013', 'M', -6);

After this how to append the String to "FREQUENCYDATA2" variable?

Can anyone help me out of this.

Thanks in advance.

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


Web FOCUS 7.7.03
PDF
 
Posts: 69 | Registered: May 24, 2013Report This Post
Virtuoso
posted Hide Post
In this case you need a book...

There is so much to do about dates that you should buy "almost 1001 ... Titlebook

It is worth the price




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report This Post
Gold member
posted Hide Post
Thankyou for your suggestion.

I will go through that book but i dont have enough time to read the book.

Can you please provide me some code to append the data to date value?


Web FOCUS 7.7.03
PDF
 
Posts: 69 | Registered: May 24, 2013Report This Post
Expert
posted Hide Post
Santu,

Please try out the search function above to help you out.

As you are new to WebFOCUS it is likely that most of the questions you have may well have been asked before - and will have been answered also.

Also check out your local branch to see what training is available to you.

T



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 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Silver Member
posted Hide Post
You can use the DATETRAN function to convert the date to a string and then use concatenation to append the text that you want to it.

REF_S10/A22 = DATETRAN(FREQUENCYDATA2,'(MDYY)','(tr)' ,'EN',22,REF_S10);

will produce a string representation of your computed date - concatenate to it as needed.

This message has been edited. Last edited by: John W Price,



WebFOCUS 8.0.2, FOCUS since 1977 - John@Aviter.com
PDF , Excel, FOCUS, Author of the Keysheets and Dates book.
www.Aviter.com
 
Posts: 40 | Registered: April 19, 2013Report This Post
Expert
posted Hide Post
You can also use the FPRINT function, much easier than the DATETRAN function:

DEFINE FILE CAR
MYDATE/YYMD WITH COUNTRY = '&YYMD';
END

TABLE FILE CAR
PRINT
COMPUTE DT1/A10 = FPRINT(MYDATE,'YYMD', 'A10');
COMPUTE DT3/A10 = FPRINT(MYDATE,'D.M.YY', 'A10');
COMPUTE DT4/A10 = FPRINT(MYDATE,'M-D-YY', 'A10');

COMPUTE DT5/A20 = FPRINT(MYDATE,'DMtYY', 'A20');
COMPUTE DT2/A20 = FPRINT(MYDATE,'MtrDYY', 'A20');
COMPUTE DT6/A20 = FPRINT(MYDATE,'DMTRYY', 'A20');
COMPUTE DT7/A20 = FPRINT(MYDATE,'wrMtrDYY', 'A20');
COMPUTE DT8/A20 = FPRINT(MYDATE,'WMTDYY', 'A20');

BY COUNTRY
END


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
John, Vivian, does the Key Sheet show how to use the FPRINT function with date columns?


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Silver Member
posted Hide Post
Francis,
No it does not. It shows the input as numeric format. This would work with "legacy dates" but not "Smart Dates" or "Date Time" (WebFOCUS).
Looks like I'll have to set up some tests to see what can be done with those data types. Thanks for the heads up.
Just checked the FOCUS Keysheet and it indicates any input field. The Dates book does not reference FPRINT at all - looks like I have a lot of work to do.

This message has been edited. Last edited by: John W Price,



WebFOCUS 8.0.2, FOCUS since 1977 - John@Aviter.com
PDF , Excel, FOCUS, Author of the Keysheets and Dates book.
www.Aviter.com
 
Posts: 40 | Registered: April 19, 2013Report This Post
Expert
posted Hide Post
John,

Thanks for looking into this. The IBI documentation on FPRINT is meagre.

Cheers,


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Gold member
posted Hide Post
Francis:

I, too, like the new FPRINT! Still need DATETRAN sometimes to get rid of those pesky commas. Add these lines and compare DT12 to DT13:

COMPUTE TEMP/YYM=MYDATE;
COMPUTE DT12/A20=FPRINT(TEMP,'MtYY','A20');
COMPUTE D13/A20=DATETRAN(TEMP,'(MYY)','(t)','EN',8,'A8');


Craig


v8.1.04, 64-bit Windows (Reporting Server), Apache Tomcat (Web/App Server), HTML, PDF, AHTML, Excel outputs
 
Posts: 57 | Location: Des Moines, IA | Registered: April 30, 2009Report This Post
Expert
posted Hide Post
Craig, thanks for pointing that out. Here's another way to eliminate the pesky comma:
COMPUTE DT11/A9 = EDIT(FPRINT(TEMP,'MtYY','A9'),'999$99999');


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Gold member
posted Hide Post
Francis:

Now I like that A LOT better than DATETRAN! Scares me that the straightforward sometimes escapes me!

Thanks...

Craig


v8.1.04, 64-bit Windows (Reporting Server), Apache Tomcat (Web/App Server), HTML, PDF, AHTML, Excel outputs
 
Posts: 57 | Location: Des Moines, IA | Registered: April 30, 2009Report This Post
Gold member
posted Hide Post
Hi all,

Problem got solved.

As Francis Mariani said its got resolved.

Thanks to everyone.....


Web FOCUS 7.7.03
PDF
 
Posts: 69 | Registered: May 24, 2013Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] How to convert the date format to String

Copyright © 1996-2020 Information Builders