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 |
Ken Blum
Constraint Violating Yak Guru
383 Posts |
Posted - 2006-01-10 : 14:59:28
|
Having a brain cramp here. How do I convert a DateTime column to Date?i.e. get "01/10/2006" from "01/10/2006 14:00:00PM" |
|
Srinika
Master Smack Fu Yak Hacker
1378 Posts |
Posted - 2006-01-10 : 15:28:47
|
Refer BOL --> Convertprint convert(varchar(10),getdate(),101)print convert(varchar(10),DateTimeCol,101) |
 |
|
Ken Blum
Constraint Violating Yak Guru
383 Posts |
Posted - 2006-01-10 : 15:42:06
|
DOH! Thanks. |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-01-10 : 22:33:31
|
>> get "01/10/2006" from "01/10/2006 14:00:00PM"if is just formating and displaying, do this in your front end application.If you want to remove the time component for comparision, use this select dateadd(day, 0, datediff(day, 0, getdate()))-----------------'KH' |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-01-12 : 07:55:25
|
>>.e. get "01/10/2006" from "01/10/2006 14:00:00PM"Where do you want to show the converted dates?If you use Front End application, use format function there>>select dateadd(day, 0, datediff(day, 0, getdate()))Also you can useselect dateadd(day, datediff(day, 0, getdate()),0)MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|