Connecting Tech Pros Worldwide Forums | Help | Site Map

date/time stamp

Newbie
 
Join Date: Aug 2009
Posts: 3
#1: Sep 2 '09
How do I separate a date/time stamp in Access 2007? I need to be able to query for certain times of day over a period of 120 days (i.e. create a query that only gives me the data for 1pm, irrespective of the date). Any suggestions?

missinglinq's Avatar
Moderator
 
Join Date: Nov 2006
Location: Richmond, Virginia USA
Posts: 3,002
#2: Sep 2 '09

re: date/time stamp


In VBA code:
DatePart("h",DateTimeField)

Or in a Query:
DatePart("h",[DateTimeField])

will retrieve the hour.

The general syntax is

DatePart("Interval",DateTimeField)

To retrieve other components, use these as the Interval

yyyy Year
q Quarter
m Month
y Day of year
d Day of Month
w Weekday
ww Week
h Hour
n Minute
s Second
Reply