Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dates by Number of Week
Message
From
19/11/2001 11:04:07
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00583459
Message ID:
00583483
Views:
43
This message has been marked as the solution to the initial question of the thread.
>Hi everybody,
>
>Given 52 weeks in a year and week definition (from Sat through Friday) I need to calculate Week's first day, week's last day and some other dates for the given year for each week. What would be a formula here?
>
>Thanks a lot in advance.

This returns the first Saturday of a given year. From there, you can add a multiple of 7 to get to any other given Saturday.

IOW, the 5th week begins on:
? firstSaturday(2001) + (5-1)*7  && depends on how you treat the days b4 the
                                 && first Saturday

procedure firstSaturday
lparameters lnYear
	return date(lnYear, 1, 1) + (7 - dow(date(lnYear, 1, 1)))
endproc
Steve Gibson
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform