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     week number is not giving me the right number

Read-Only Read-Only Topic
Go
Search
Notify
Tools
week number is not giving me the right number
 Login/Join
 
Silver Member
posted
Hello,

I am trying to get the week number for a particular date field but I am not getting the right week for jan 01.
for example, 20150101 the week number should be 1 but it is returning 52.
20160101 the week number should be 1 but it is returning 52.
any other days seems to be fine.

calendar_yywk = CAL_YEAR * 100 +HPART(HDTTM( FULL_DATE,8,'HYYMDIA'),'WEEK', 'I2')---> for 20150101 is returning 201552, 20160101 returning 201652
where CAL_YEAR I4 is DATE_INT / 10000, FULL_DATE is the date in YYMD format and DATE_INT is the FULL_DATE in integer format.

Does anyone knows how to solve this?


thanks,

V

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


WebFOCUS 8.2.0.7,
Application Studio,
Webfocus Info-Assist
iWay Service Manager,
iWay Data Migrator
Windows, All Outputs
IBM DB2/400, MS SQL-Server 2014
 
Posts: 43 | Registered: September 30, 2015Report This Post
Expert
posted Hide Post
Do a Google search for 'week numbers for 2015' and you will find



The first days of a year are generally included in the last days of the previous year.


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
Virtuoso
posted Hide Post
The behaviour is correct. What's more of a challenge is to get the correct year printed with that week number at the start or end of a year.

Several RDBMS's provide a separate variant of a to_char pattern to extract the year for use with a week number.
For example, to_char(CURRENT_DATE, 'IYYY/IW') gives the ISO-8601 year/week, which results in year 2014 for week 53, regardless of whether we're looking at 2014/12/31 or at 2015/01/01.

In contrast, to_char(CURRENT_DATE, 'YYYY/IW'), which gives the calendar year with the week (for week 53 in 2014, that incorrectly gives 2015 for 2015/01/01)


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     week number is not giving me the right number

Copyright © 1996-2020 Information Builders