Developing the mathematics still further.

```
getDateFromYearByWeekNumAndDayInWeek(2011, 2, 2)
-- Based on a handler by "DJ Bazzie Wazzie". In this version, the weekNum and dayInWeek parameters number from 1. (They numbered from 0 in the original.)
on getDateFromYearByWeekNumAndDayInWeek(theYear, weekNum, dayInWeek)
--According to ISO and NEN: week start at monday and week 1 is the week with 4th of jan
--According to US: week starts at sunday and week 1 if the week with 1st of jan
-- According to much of the Middle East: week starts on Saturday and week 1 contains 1st of Jan.
-- Change this to the preferred week-start day.
set weekStart to Monday
--change this value to 1 when you want US or Middle East (much of the).
set JanuaryDayInWeek1 to 4
tell (current date) to set {its day, its month, its year, its time, knownDateInWeek1} to {JanuaryDayInWeek1, January, theYear, 0, it}
set yearStart to knownDateInWeek1 - (((knownDateInWeek1's weekday) - weekStart + 7) mod 7) * days
set theDate to yearStart + (weekNum - 1) * weeks + (dayInWeek - 1) * days
return theDate
end getDateFromYearByWeekNumAndDayInWeek
```

. which can of course be further reduced to .

```
getDateFromYearByWeekNumAndDayInWeek(2011, 2, 2)
-- Based on a handler by "DJ Bazzie Wazzie". In this version, the weekNum and dayInWeek parameters number from 1. (They numbered from 0 in the original.)
on getDateFromYearByWeekNumAndDayInWeek(theYear, weekNum, dayInWeek)
--According to ISO and NEN: week start at monday and week 1 is the week with 4th of jan
--According to US: week starts at sunday and week 1 if the week with 1st of jan
-- According to much of the Middle East: week starts on Saturday and week 1 contains 1st of Jan.
-- Change this to the preferred week-start day.
set weekStart to Monday
--change this value to 1 when you want US or Middle East (much of the).
set JanuaryDayInWeek1 to 4
tell (current date) to set {its day, its month, its year, its time, knownDateInWeek1} to {JanuaryDayInWeek1, January, theYear, 0, it}
return knownDateInWeek1 + (weekNum * 7 + dayInWeek - 8 - ((knownDateInWeek1's weekday) - weekStart + 7) mod 7) * days
end getDateFromYearByWeekNumAndDayInWeek
```

. or perversely .

```
getDateFromYearByWeekNumAndDayInWeek(2011, 2, 2)
-- Based on a handler by "DJ Bazzie Wazzie". In this version, the weekNum and dayInWeek parameters number from 1. (They numbered from 0 in the original.)
on getDateFromYearByWeekNumAndDayInWeek(theYear, weekNum, dayInWeek)
--According to ISO and NEN: week start at monday and week 1 is the week with 4th of jan
--According to US: week starts at sunday and week 1 if the week with 1st of jan
-- According to much of the Middle East: week starts on Saturday and week 1 contains 1st of Jan.
-- Change this to the preferred week-start day.
set weekStart to Monday
--change this value to 1 when you want US or Middle East (much of the).
set JanuaryDayInWeek1 to 4
tell (current date)
set {its day, its month, its year, its time} to {JanuaryDayInWeek1, January, theYear, 0}
return it + (weekNum * 7 + dayInWeek - 8 - ((its weekday) - weekStart + 7) mod 7) * days
end tell
end getDateFromYearByWeekNumAndDayInWeek
```