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     calculate number of weeks between two yyyymmdd dates

Read-Only Read-Only Topic
Go
Search
Notify
Tools
calculate number of weeks between two yyyymmdd dates
 Login/Join
 
Member
posted
Does anyone has codes to calculate number of weeks between two yyyymmdd dates ?
week define as Monday to Sunday, if begin date is not Monday then 1st week is partial and all the other weeks are from Monday to Sunday until the last week equal to ending date and it can be partial too.


WF 8202, windows
 
Posts: 3 | Location: Dallas, TX | Registered: October 22, 2008Report This Post
Virtuoso
posted Hide Post
Dear Pro

If you compute the two dates as a number since the beginning of the year and divide that number by 7 and as integer you have two weeknumbers.
the difference is your result.




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
Guru
posted Hide Post
Hi Pro4GL,

What do you want to see when startdate is in week 4 on friday and enddate is in week 5 on tuesday? Should this be 1 week since it's a different week, or 0 week because there are less then 7 days in between?


Test: WF 8.2
Prod: WF 8.2
DB: Progress, REST, IBM UniVerse/UniData, SQLServer, MySQL, PostgreSQL, Oracle, Greenplum, Athena.
 
Posts: 454 | Location: Europe | Registered: February 05, 2007Report This Post
Expert
posted Hide Post
You could use the Date/Time function HDIFF "Find the Number of Units Between Two Date-Time Values" which allows for a Week component (it even allows you set the first day of the week using the WEEKFIRST parameter - SET WEEKFIRST = 7). You simply have to convert the Date columns to Date/Time columns using the Date/Time function HDTTM "Convert a Date Value to a Date-Time Value". Check out the WebFOCUS Functions manual.

DEFINE FILE CAR
DT1/YYMD = '20080910';
DT2/YYMD = '20081025';

-*-- Convert Date to Date/Time
DTTM1/HYYMDS = HDTTM(DT1, 8, 'HYYMDS');
DTTM2/HYYMDS = HDTTM(DT2, 8, 'HYYMDS');

DIFF1/D6 = HDIFF(DTTM2, DTTM1, 'WEEK', 'D6');
END

TABLE FILE CAR
PRINT
COUNTRY

DT1 DT2

DTTM1 DTTM2

DIFF1
WHERE READLIMIT EQ 1
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
Platinum Member
posted Hide Post
Get for both Starting Date and Stopping Date
1) the number of times 7 is "included in"
2) the remainder of this division
(YYMMDD is a number of Days since something around 31/12/1900, but you probably know better than I ..)
The remainder of the division gives the Day in the week : Monday is 0 and Sunday 6.
With this information Stachanov can solve your problem.
Some One-Liners will give you more concise solutions.
But it's the idea and Focus doesn't any longer need Masking Dates or INUMBEROFDAYS because the Date Format is great ( and Popular ?)
Cordialement


Focus Mainframe 7.6.11
Dev Studio 7.6.11 and !!!
PC Focus, Focus for OS/2, FFW Six, MSO
 
Posts: 134 | Registered: November 06, 2007Report This Post
Platinum Member
posted Hide Post
My Godness, I've turned Sylver member !!!
Rather think of a growing old Don Quichotte, with a rusty armour. (and still with the head in the stars, notwithstanding the fact that his feet are in the mud ...)
Focusely and Cordialy


Focus Mainframe 7.6.11
Dev Studio 7.6.11 and !!!
PC Focus, Focus for OS/2, FFW Six, MSO
 
Posts: 134 | Registered: November 06, 2007Report This Post
<JG>
posted
quote:
PC Focus, Focus for OS/2, FFW Six

I hope you’ve cancelled the maintenance.
 
Report This Post
Expert
posted Hide Post
And I thought a non-production version of WF 5.3.2 was bad!


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
Platinum Member
posted Hide Post
hi PRO4GL ,

We use a T_DB2_ACCT_DATE table . It is universal and can be used in any server. In that table we have a field called WK_I ( week ID) , using this column we can easily calculate the no. of weeks between any two dates.

you can ask ur admin to set up this table for you. This comes in handy and is very useful.

regards

Aravindan


WebFOCUS 714
Windows XP
Output: HTML,PDF,Excel
 
Posts: 189 | Registered: January 30, 2008Report This Post
Platinum Member
posted Hide Post
I, also, had the opportunity to sing 'Time is on my side' along with Mick Jagger (Which Version Mick Jagger ?)
But I know that my children or the children of my children will pass over your declining cleverness ...
Focusely
I thank you for the maintenance advice, I'll do that right now, along with bringing back my Minitel to the Post Office.


Focus Mainframe 7.6.11
Dev Studio 7.6.11 and !!!
PC Focus, Focus for OS/2, FFW Six, MSO
 
Posts: 134 | Registered: November 06, 2007Report This Post
Expert
posted Hide Post
You must keep that Minitel, as a portal into the old world.


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
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     calculate number of weeks between two yyyymmdd dates

Copyright © 1996-2020 Information Builders