Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

datetime to date

Status
Not open for further replies.

sbcsandhu

Programmer
Jul 3, 2007
113
US
my date is a datetime field. what is the function i would use to change it to only a date
 
I assume you mean that you would want a datetime field w/o the time precision - i.e. a date that started at 00:00.000?

Code:
select convert(datetime, datediff(dd, 0, getdate()))

-kaht

Lisa, if you don't like your job you don't strike. You just go in every day and do it really half-assed. That's the American way. - Homer Simpson
[small]<P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <.</B> bites again.[/small]
 
There's no such thing as a date data type. There is always a time component. Sorry.


-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
I think there is in SQL Server 2008 ;-)

[small]----signature below----[/small]
Now you can go where the people are one!
Now you can go where they get things done!
 
So... sometime in the future, my answer will be wrong. [sad]

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top