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 2005 Forums
 Transact-SQL (2005)
 convert week number back to first date

Author  Topic 

jamie
Aged Yak Warrior

542 Posts

Posted - 2008-02-28 : 08:32:14
hi guys,
How could I convert 'week 9 2008' back into the first day of that week ?

is that even possible ?

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-02-28 : 08:37:38
dateadd(week, 9, '2008-01-01')


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

jamie
Aged Yak Warrior

542 Posts

Posted - 2008-02-28 : 08:39:50
amazing !
and can I get the last day of that week also ?
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-02-28 : 08:44:31
dateadd(week, 9, '2008-01-01')+6

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

jamie
Aged Yak Warrior

542 Posts

Posted - 2008-02-28 : 08:53:46
doh ! easy when yuo know how !
Thank you very much.
Go to Top of Page

elezotte
Starting Member

1 Post

Posted - 2008-05-02 : 19:33:56
The following does not work because the first day of the year is not always at the beginning of the week. You need to account for this.

quote:
Originally posted by khtan

dateadd(week, 9, '2008-01-01')


KH
[spoiler]Time is always against us[/spoiler]



Go to Top of Page
   

- Advertisement -