Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dates by Number of Week
Message
From
19/11/2001 12:59:30
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00583459
Message ID:
00583572
Views:
14
This message has been marked as a message which has helped to the initial question of the thread.
Nadya,

I use this function for finding what's the first day of week 1. (It's only tested with SET("FWEEK") = 2 AND SET("FDOW") = 2)
FUNCTION Fdow1
LPARAMETERS lnYear, lnFirstWeek, lnFirstDay
******************************************************************************
* Fdow1(expN1, expN2, expN3)
* expN1	= Year
* expN2 = Regional setting of what's first week of year
* expN3 = Regional setting of what's first day of week
*
* Returns the first day of a week that has week number 1. This could be a date
* the previous year.
*
* Return type: date
******************************************************************************
LOCAL ldRetVal

IF EMPTY(lnFirstWeek)
	lnFirstWeek = SET("FWEEK")
ENDIF

IF EMPTY(lnFirstDay)
	lnFirstDay = SET("FDOW")
ENDIF

lnI = 1
ldRetVal = DATE(lnYear, 1, lnI)

DO WHILE WEEK(ldRetVal, lnFirstWeek, lnFirstDay) > 1
	lnI = lnI + 1
	ldRetVal = DATE(lnYear, 1, lnI)
ENDDO

ldRetVal = ldRetval - DOW(ldRetVal, lnFirstDay) + 1

RETURN ldRetVal
>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.
Previous
Reply
Map
View

Click here to load this message in the networking platform