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

date issue

Status
Not open for further replies.

andyc209

IS-IT--Management
Dec 7, 2004
98
GB
probably really easy but its foxed me

i have a date field in which a number of records have the date as DateTime and it shows todays date as 4/10/2010 00:00:00
but if i create a query with Getdate() it does not find the above records as getdate() has the time as well i assume
how can i do the query to get the date without the time or at least to 00:00:00

thanks
 
The best way is this:

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

This will set the time component of a DateTime value to 0 while not changing the day part of it.

-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