| Author |
Topic  |
|
|
Ken Blum
Constraint Violating Yak Guru
378 Posts |
Posted - 01/10/2006 : 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
Flowing Fount of Yak Knowledge
Sri Lanka
1378 Posts |
Posted - 01/10/2006 : 15:28:47
|
Refer BOL --> Convert print convert(varchar(10),getdate(),101)
print convert(varchar(10),DateTimeCol,101)
|
Edited by - Srinika on 01/10/2006 15:34:26 |
 |
|
|
Ken Blum
Constraint Violating Yak Guru
378 Posts |
Posted - 01/10/2006 : 15:42:06
|
| DOH! Thanks. |
 |
|
|
khtan
In (Som, Ni, Yak)
Singapore
16746 Posts |
Posted - 01/10/2006 : 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
India
22461 Posts |
Posted - 01/12/2006 : 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 use
select dateadd(day, datediff(day, 0, getdate()),0)
Madhivanan
Failing to plan is Planning to fail |
 |
|
| |
Topic  |
|