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).
 
Back
Top