Extracting hour

C

Chris McK

I have a query that pulls a ton of data that includes a time/date field (ie...12/01/2003 11:59am). What I want to extract is just the hour so that over a date range I can say that between 11am and 12pm X number of items appear. I have tried the format of Hour:format(hh,[TIMEDATEFIELD]) but it still doesn't work. It will return just 11 for 11 O'Clock, but won't count...Access still sees the complete time date field even though it only displays the hour

Does anyone know of another way to do this

Thank
 
A

Allen Browne

Try:
DatePart("h", [timedatefield])

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Chris McK said:
I have a query that pulls a ton of data that includes a time/date field
(ie...12/01/2003 11:59am). What I want to extract is just the hour so that
over a date range I can say that between 11am and 12pm X number of items
appear. I have tried the format of Hour:format(hh,[TIMEDATEFIELD]) but it
still doesn't work. It will return just 11 for 11 O'Clock, but won't
count...Access still sees the complete time date field even though it only
displays the hour.
 
Top