I'm trying the below:
select convert(datetime,getdate(),101)
Yet this returns the time portion, even though the 101 parameter specifically says it formats the conversion in mm/dd/yy.
I would expect:
select convert(datetime,'5/5/1955 5:55 AM'101)
...should return:
[COLOR=blue ]5/5/1955[/color]
...but instead it returns:
[COLOR=blue ]2005-05-05 05:55:00.000[/color]
I would even accept:
[COLOR=blue ]2005-05-05 00:00:00.000[/color]
...because this will be used in a sql statement against a datetime field, but the stored data has no time component, ie, it's midnight.
So what is the *style* parameter for if it doesn't seem to do anything close to what it states?
What I'm really looking to do is find the shortest way to strip the time from a datetime value--but keep it a datetime data type--again--force the time to be midnight.
I tried using Varchar in the convert(), and it seemed to work--but again--why would I want to convert to varchar--it's a Datetime that I want. If that's "the way" then fine, but I just figured I'd convert a datetime to a datetime with an empty or zero time.
Thanks
--Jim
select convert(datetime,getdate(),101)
Yet this returns the time portion, even though the 101 parameter specifically says it formats the conversion in mm/dd/yy.
I would expect:
select convert(datetime,'5/5/1955 5:55 AM'101)
...should return:
[COLOR=blue ]5/5/1955[/color]
...but instead it returns:
[COLOR=blue ]2005-05-05 05:55:00.000[/color]
I would even accept:
[COLOR=blue ]2005-05-05 00:00:00.000[/color]
...because this will be used in a sql statement against a datetime field, but the stored data has no time component, ie, it's midnight.
So what is the *style* parameter for if it doesn't seem to do anything close to what it states?
What I'm really looking to do is find the shortest way to strip the time from a datetime value--but keep it a datetime data type--again--force the time to be midnight.
I tried using Varchar in the convert(), and it seemed to work--but again--why would I want to convert to varchar--it's a Datetime that I want. If that's "the way" then fine, but I just figured I'd convert a datetime to a datetime with an empty or zero time.
Thanks
--Jim