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 |
arkiboys
Master Smack Fu Yak Hacker
1433 Posts |
Posted - 2007-10-26 : 08:42:07
|
Hi,I would like to get the date and time but without the millisecond.i.e.select getdate()but this returns milliseconds which I do not want.Thanks |
|
arkiboys
Master Smack Fu Yak Hacker
1433 Posts |
Posted - 2007-10-26 : 08:44:16
|
How aboutselect convert(char(20), getdate(), 113)? |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-10-26 : 08:51:36
|
quote: Originally posted by arkiboys How aboutselect convert(char(20), getdate(), 113)?
That would become varchar. You need to convert it back to datetimeselect cast(convert(char(20), getdate(), 113) as datetime)MadhivananFailing to plan is Planning to fail |
 |
|
NeilG
Aged Yak Warrior
530 Posts |
Posted - 2007-10-26 : 08:56:45
|
Does Cast (detdate() as smalldatetime)Not also work |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-10-26 : 09:00:29
|
quote: Originally posted by NeilG Does Cast (detdate() as smalldatetime)Not also work
That will omit seconds as wellMadhivananFailing to plan is Planning to fail |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-10-26 : 09:06:57
|
Without datatype convertion use thisselect dateadd(ms,-(datepart(ms,getdate())),getdate())MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|