>>Hi all.
>>The question says itself!
>>
>>Has anybody a solution?
>>
>>
>>Best regards
>>
>>Per Simmersholm
>
>Well, the question is open to interpretation. But, if the question means how can I find the first day of the week for a given week number in the year, then try this:
>
>*-- Start
>FUNCTION Day1
>PARAMETERS lnWeek
>LOCAL lnThisWeek, ldTodayInWeek, ldFirstDayInWeek
>
>lcThisWeek = WEEK( DATE())
>
>ldTodayInWeek = DATE() - ((lcThisWeek - lnWeek) * 7)
>
>*-- Now to get first day of week
>ldFirstDayInWeek = ldTodayInWeek - ( DOW( ldTodayInWeek) - SET("FDOW"))
>
>RETURN ldFirstDayInWeek
>*-- End
>
>Which will work with the current settings of FWEEK and FDOW
Then Mark,
For any given week number as a parameter it could be :
function xFDOW
lparameters tnWeekNumber, tnDOWSet
if parameters()<2
tnDOWSet = 0
endif
local lnOldDateSet,ldJan1st,ldWeek,ldFdow
lnOldDateSet = set("date",1)
set date to mdy
ldJan1st = ctod("1/1/"+str(year(date()),4))
ldWeek = (tnWeekNumber - 1) * 7 + ldJan1st
ldFdow = ldWeek - (dow(ldWeek,tnDOWSet)) + 1
do case
case lnOldDateSet = 1
set date to dmy
case lnOldDateSet = 2
set date to ymd
endcase
return ldFdow
Cetin