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 |
|
madscientist
Starting Member
30 Posts |
Posted - 2007-12-04 : 19:35:04
|
| Hi everyone.In the HEADER table I have a column name BOOK_FLAG_DATE which has dates in the format:7/6/2006 14:37:22I want to convert the dates to just the number of days elapsed since that year began i.e. in this case 187. Thank you for the help. |
|
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-12-04 : 19:38:08
|
| [code]Declare @D Datetime , @D2 datetimeSet @d = '7/6/2006 14:37:22'select datediff(dd, convert(varchar,Year(@d)) + '0101', @d )[/code]Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-12-05 : 03:14:24
|
| orDeclare @D Datetime , @D2 datetimeSet @d = '7/6/2006 14:37:22'select datepart(dayofyear, convert(datetime,@d))MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|