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.
| Author |
Topic |
|
ams006
Yak Posting Veteran
55 Posts |
Posted - 2009-12-02 : 08:18:36
|
| Hi All, I have a date field e.g 02/12/2009 and need to be able to calculate the Monday's date of the week which the date field falls into i.e. I need to have returned to me 30/11/2009 which is the Monday of that week. Any help will be appreciated. ams006 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-12-02 : 08:40:27
|
| declare @t datetimeset @t=convert(datetime,'02/12/2009',103)select dateadd(week,datediff(week,0,@t),0)MadhivananFailing to plan is Planning to fail |
 |
|
|
ams006
Yak Posting Veteran
55 Posts |
Posted - 2009-12-02 : 08:59:01
|
| Thanks for your help madhivanan......nice one! |
 |
|
|
vikky
Yak Posting Veteran
54 Posts |
Posted - 2009-12-03 : 03:58:34
|
| HI,this one also helps u.declare @date datetimeselect @date = convert(datetime,'12/12/2009',103)select dateadd(d,-datepart(dw,@date)+2,@date)Thanks,vikky. |
 |
|
|
|
|
|
|
|