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 |
|
Suresh1616
Starting Member
2 Posts |
Posted - 2010-01-04 : 11:45:07
|
| Can anyone get the date format from yyww format i.e, from yyww to yyyymmdd and the date i expect to be the last day of the week specified i.e, a saturday.For eg : yyww : 1002 (2010 2nd week)expected result yyyy-mm-dd : 2010-01-09Suresh |
|
|
jackv
Master Smack Fu Yak Hacker
2179 Posts |
Posted - 2010-01-04 : 13:33:31
|
| Could you clarify - you have 1002 (i.e 2010 and second week ) - is it the start of the 2nd week you are looking for? as the second week , can be made up of 7 daysJack Vamvas--------------------http://www.ITjobfeed.com |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-01-05 : 02:10:28
|
quote: Originally posted by Suresh1616 Can anyone get the date format from yyww format i.e, from yyww to yyyymmdd and the date i expect to be the last day of the week specified i.e, a saturday.For eg : yyww : 1002 (2010 2nd week)expected result yyyy-mm-dd : 2010-01-09Suresh
You may need thisdeclare @value int set @value= 1002select dateadd(week,datediff(week,0,dateadd(year, 2000 + @value / 100-1900,0))+(@value % 100),-2)MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|