Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 how to convert a week number into a range of dates

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-08-29 : 07:21:44
tanuja writes "i have a query

select week(t_start), year(start) from abc ;

t_start is of type timestamp....

so i get the result as say:

33 2005


which indicates that it is 33rd week of the year 2005.....

now, i need to display the week as the range of dates ...

i.e, 08/14/2005 ---- 08/21/2005

so i need to get the start date of a week given the week number and the year...

but how?"

robvolk
Most Valuable Yak

15732 Posts

Posted - 2005-08-29 : 07:23:41
SELECT DateAdd(week, DateDiff(week, 0, t_start), 0) BeginWeek,
DateAdd(day, -1, DateAdd(week, DateDiff(week, 0, t_start)+1, 0)) EndWeek
FROM abc
Go to Top of Page
   

- Advertisement -