Get the date of a given day in a given week...
- by Sean.C
i need to start at a year-month and work out what the date it is in a given week, on a given day within that week..
i.e
year: 2009
month: 10
week: 5
day-number: 0
would return 2009-10-25 00:00:00 which is a sunday. Notice week 5, there is no day 0 in week 5 in 2009-10 as the sunday in that logical week is 2009-11-01 00:00:00... so week 5 would always return the last possible date for the given day in the given month..
if you havn't guessed already i'm messing with the c struct TIME_ZONE_INFORMATION (link text) which is pretty crazy if i'm fair...
Date math and SQL are something to be admired, sadly its something i have never really dug deep into beyond stripping times. Any help would be greatly appriciated.
PS: mssql 2005 btw..