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

Date question

Status
Not open for further replies.

icemel

MIS
Oct 17, 2005
463
US
Hi,

Thanks for eveyone's help so far... it's been very helpful!

My question now is this... I have a query that needs to find all the records that are within a certain time frame, see below:

WHERE effectiveDate >= GETDATE()-7 and effectiveDate <= GETDATE()

The problem is, GETDATE() starts at the current date and TIME. I would like to start my beginning date to today's date minus seven days, but starting at MIDNIGHT, not 1:30 in the afternoon or whatever time it is I run this query.

How can I do this??

THANKS
 
found it -

SELECT DATEADD(dd, DATEDIFF(dd, 0, GETDATE()), 0)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top