Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How many weeks in a month
Message
 
 
To
08/11/2007 11:56:04
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01266837
Message ID:
01267710
Views:
20
Hi Sergey,

Is this better? :)
ldLastOfYear    = DATE(lnYear, 12, 31)
lnWeeksInYear   = MAX(WEEK(ldLastOfYear,1,2), WEEK(ldLastOfYear-7,1,2))
lnWeeksPerMonth = MOD(WEEK(GOMONTH(ldFirstOfMonth,1),1,2) + lnWeeksInYear - ;
					WEEK(ldFirstOfMonth,1,2), lnWeeksInYear)
Counting sundays could be simpler in this case though.

>Sorry for delay, I've been on vacation:)
>I've tested your code against mine. It gives wrong results for Decembers in some years, e.g. in 2000, 2006, 2012, 2017, 2023, ...
>
<snip>
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform