Date and time query

G

Guest

I have a table that records time-stamps with the date and time contained in
the same column. How do I query these fields to only show the time or only
show the dates?

LASTUPDATEDT
4/23/2007 11:48:30 AM
 
D

Douglas J. Steele

For same date:

WHERE DateValue(MyDateTimeField) = #04/23/2007#

or

WHERE MyDateTimeField BETWEEN #04/23/2007# AND #04/24/2007#

For same time:

WHERE TimeValue(MyDateTimeField) = #11:48:30#
 
J

John W. Vinson

I have a table that records time-stamps with the date and time contained in
the same column. How do I query these fields to only show the time or only
show the dates?

LASTUPDATEDT
4/23/2007 11:48:30 AM

You can set the Format of a textbox to Short Date or Short Time to display
only the date or time posted - you can even have two textboxes both bound to
the field (don't allow them to be updated though, or the date field will put
in a time of midnight and the time field a date of 12/30/1899!)

To search for a date use a criterion like
= DateValue([Enter date:]) AND < DateAdd("d", 1, DateValue([Enter date:]))

John W. Vinson [MVP]
 

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

Top