` Comment on an Icetips Article
Icetips - Templates, Tools & Utilities for Clarion Developers

Templates, Tools and Utilities
for Clarion Developers

Add a comment to an Icetips Article

Please add your comments to this article. Please note that you must provide both a name and a valid email address in order for us to publish your comment. Comments are moderated and are not visible until they have been approved. Spam is never approved!

Your Name:  
Email:  
Header text/Subject:  

Please enter your comment in the box below:

Back to article list   Search Articles     Add Comment     Printer friendly     Direct link  

Par2: Week of year
2001-01-17 -- Michael Euler
 
Ok, this is my approach, which worked for years now. Calc_Week FUNCTION(Date) Code Week# = 0 if Date[1:2] < 1 or Date[1:2] > 31 or Date[3:4] < 1 or Date[3:4] > 12 return 0 end Day# = Date[1:2] Month# = Date[3:4] Year# = Date[5:8] First_Day# = (Date(1,1,Year#) % 7) + 1 ! first day of year (1=Sunday) if First_Day# < 6 NumOf_Days# = First_Day# + 4 else case First_Day# of 6 NumOf_Days# = 3 of 7 NumOf_Days# = 4 of 1 NumOf_Days# = 5 end end Days_Year# = date(month#,day#,year#) - date(1,1,year#) + 1 ! 'gone' days All_Days# = Days_Year# + NumOf_Days# Week# = Int(All_Days# / 7) if Week# < 1 Week# = 53 end return Week#


Today is November 21, 2024, 6:49 am
This article has been viewed 35211 times.



Back to article list   Search Articles   Add Comment   Printer friendly

Login

User Name:

Password: