Current date

  • Thread starter Thread starter Chi Huynh
  • Start date Start date
C

Chi Huynh

Hi,
I need to create a query that pulls the current day.
Please show me what criteria I should set.
Thank you
Chi Huynh
 
Hi,
I need to create a query that pulls the current day.
Please show me what criteria I should set.
Thank you
Chi Huynh

I'm assuming that you have a Date/Time field in the table. If it
contains a pure date (that is, if you use Date() as the default or
just enter a date with no Time portion) use a query criterion of

Date()

If it contains both a date and time, use instead
= Date() AND < DateAdd("d", 1, Date())

to select all records any time on today's date.
 
select * from yourTableName
where int(theDateTime) = date()

Well, this will work but it's not terribly efficient since it a)
ignores any index on theDateTime and b) forces a conversion from
Date/Time to integer back to Date/Time. WHERE DateValue(theDateTime) =
Date() is equivalent (without the double conversion).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Type of Data 6
Meeting Request 4
Excel - Formatting 8
% 1
Calendar 2
Parameter Criteria 3
SUMIF 2
sorting by dates -- parameters? 1

Back
Top