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 |
|
muvvasiva
Starting Member
14 Posts |
Posted - 2009-06-24 : 02:05:37
|
| hi all i have to eliminate milli seconds from the following data.LastModified============2009/06/01 12:36:39.9582007/11/16 15:59:20.3122007/12/18 12:24:52.7482007/11/16 15:59:20.2342008/04/15 10:20:46.7092008/04/15 10:20:46.7412008/07/17 8:58:59.8222007/12/10 15:32:0.421i have to select from above column as followsLastModified=============2009/06/01 12:36:392007/11/16 15:59:202007/12/18 12:24:522007/11/16 15:59:202008/04/15 10:20:462008/04/15 10:20:462008/07/17 8:58:592007/12/10 15:32:0here, i have to eliminate fraction of seconds from data pls help |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-06-24 : 02:08:49
|
select dateadd(millisecond, -datepart(millisecond, LastModified), LastModified) KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
Nageswar9
Aged Yak Warrior
600 Posts |
Posted - 2009-06-24 : 02:18:30
|
| Hi, see this it is useful for uhttp://www.sql-server-helper.com/tips/date-formats.aspx |
 |
|
|
saran_d28
Starting Member
36 Posts |
Posted - 2009-06-24 : 02:55:03
|
| Hi,You can use the conver function.select convert(char(20),'2009/06/01 12:36:39.958', 120)ThanksSaravanan |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-06-24 : 02:56:24
|
quote: Originally posted by saran_d28 Hi,You can use the conver function.select convert(char(20),'2009/06/01 12:36:39.958', 120)ThanksSaravanan
that will be changing the data type of the result. Unless you convert it back to datetime. KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
muvvasiva
Starting Member
14 Posts |
Posted - 2009-06-24 : 05:33:24
|
| Thank you very much for all who replied with great concernThank you |
 |
|
|
|
|
|
|
|