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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

convert Datetime to Date without using varchar or char

Status
Not open for further replies.

fredong

IS-IT--Management
Sep 19, 2001
332
US
Hi,
Is there a way to convert Datetime to Date without using varchar or char? This is because the date will be using for calculation later. Thanks.
 
You cannot convert to Date (only), but you can remove the time component. The time component will still be there, but the following code will set it to midnight.

[tt][blue]Select DateAdd(Day, DateDiff(Day, 0, GetDate()), 0)[/blue][/tt]

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top