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 |
|
cwtriguns2002
Constraint Violating Yak Guru
272 Posts |
Posted - 2008-02-04 : 22:33:01
|
| hi everyone... i have a question on datetime value.How could I replace the time value to '00:00:00'?for example, i have a datetime value of '2008-02-05 11:24:03.030'my expected result is '2008-02-05 00:00:00'RON________________________________________________________________________________________________"I won't last a day without SQL" |
|
|
hey001us
Posting Yak Master
185 Posts |
Posted - 2008-02-04 : 22:41:15
|
| CAST(LEFT('2008-02-05 11:24:03.030', 11) AS datetime)hey |
 |
|
|
hey001us
Posting Yak Master
185 Posts |
Posted - 2008-02-04 : 22:49:53
|
| OR DATEADD(dd,DATEDIFF(dd, 0,'2008-02-05 11:24:03.030'),0)hey |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-02-04 : 22:53:04
|
| or CAST(CONVERT(varchar(11),'2008-02-05 11:24:03.030') AS datetime) |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-02-05 : 08:00:36
|
quote: Originally posted by visakh16 or CAST(CONVERT(varchar(11),'2008-02-05 11:24:03.030') AS datetime)
Effecient method isDateadd(day,datediff(day,0,datecol),0)MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|