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] Obtain month from a date.

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Obtain month from a date.
 Login/Join
 
Platinum Member
posted
What function do I use to extract month out of a date?

Thanks.

This message has been edited. Last edited by: Tamra,
 
Posts: 176 | Location: Desplaines | Registered: August 05, 2004Report This Post
Guru
posted Hide Post
Depends on the format of the date and the format desired for the month.

In the upper right of this screen, click on 'Technical Documentation Library' and search for date functions; you should be able to get more than enough information.

HTH
 
Posts: 252 | Location: USA | Registered: April 15, 2003Report This Post
Platinum Member
posted Hide Post
The format in the MFD is defined as DATE and the source is a DB2 table.

Thx.
 
Posts: 176 | Location: Desplaines | Registered: August 05, 2004Report This Post
Silver Member
posted Hide Post
In that case, just create a DEFINE with the Month format:

DEFINE FILE TABLENAME
MONTH/M = DATEFIELD;
END

TABLE FILE TABLENAME
PRINT MONTH
END
 
Posts: 40 | Registered: March 10, 2004Report This Post
Master
posted Hide Post
I'm not sure if what Terry provided will work with DATE. If the format is as FOCUS smart date it should. There are 2 formats in the master file description something like

FIELDNAME=MYDATE,MDATE,HYYMDs,DATE,$

Is DATE the first or second and if the second what is the first.
 
Posts: 865 | Registered: May 24, 2004Report This Post
Gold member
posted Hide Post
It took me 45 minutes to figure this out, but here is what I had to do:

The date I wanted to extract the month from was in an HYYMDS format. I'll call it BEGIN_DATE. I had to use HDATE to get it in a usable format. Then I simply used that field to populate a new field that had the format of M.

BEGIN_DATE_NEW_FORMAT/MDYY=HDATE(BEGIN_DATE, 'MDYY');
RPT_MTH/M=BEGIN_DATE_NEW_FORMAT;


Kevin Patterson
Appalachian State University
WebFOCUS 7.7.03
Windows, All Outputs
 
Posts: 57 | Registered: February 29, 2012Report This Post
Expert
posted Hide Post
You may be able to use a single function using HPART:

MY_DATE_TIME_M/M = HPART(MY_DATE_TIME, 'MONTH', 'I2');


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
Guru
posted Hide Post
I always joke that WebFocus is great for giving us easy ways of doing hard things, but the easy things are hard to do. Dates are a perfect example. I have to refer to the documentation every single time I have to do anything with a date field. That said, it always works out ok in the end.


Webfocus 8
Windows, Linux
 
Posts: 258 | Location: Palm Coast, FL | Registered: February 05, 2010Report This Post
Master
posted Hide Post
quote:
Originally posted by Kevin Patterson:
It took me 45 minutes to figure this out...

That's a pretty fast time in which to solve a WebFOCUS date problem.


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
 
Posts: 594 | Location: Michigan | Registered: September 04, 2015Report This Post
Master
posted Hide Post
quote:
Originally posted by Mike in DeLand:
I have to refer to the documentation every single time I have to do anything with a date field.

I have to refer to this forum every single time I have to do anything with a date field. The IBI documentation and the infamous 3rd party book dedicated to WebFOCUS dates just muddies the date waters even more, in my opinion.


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
 
Posts: 594 | Location: Michigan | Registered: September 04, 2015Report This Post
Guru
posted Hide Post
I try to copy my date functions into a document and then try to remember where I put that document


WF 7.6.11
Oracle
WebSphere
Windows NT-5.2 x86 32bit
 
Posts: 398 | Registered: February 04, 2008Report This Post
Virtuoso
posted Hide Post
I'm quite happy with the new 'Simplified' versions of functions, such as the Simplified date and time functions: http://infocenter.informationb.../source/topic168.htm

Referring back to another ongoing thread about week numbers (assuming ISO8601 weeks here): Unfortunately these functions do provide an incantation to get the week number of the year, but they lack the ability to tell what year that week belongs to.

For example, January 1st would correctly return week 53 for those weeks that started in December in the previous year, but it would return this year with that week number instead of last year. That's a bit nasty because there are only a couple of weeks per year that you can find out that you made that mistake! And it doesn't happen every year either, this year being a good example.


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report 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] Obtain month from a date.

Copyright © 1996-2020 Information Builders