date/time conversion

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mcgr0199
    New Member
    • Aug 2009
    • 3

    date/time conversion

    I have temperature data loggers that record temperature every 6 minutes for 120 days. When I upload the data to access the date/time field is automatically formatted from the data loggers to be in this format: 6/15/2009 12:06:00 AM. What I need to do with the data is look at certain time frames over the entire 120 day period (i.e. from 12pm to 9pm every day). How can I run a query to get just those times over that entire period? I've tried doing something like this: Between (DateSerial())+ TimeSerial()) And (DateSerial())+ TimeSerial()), but don't know how to specify only PM. Any suggestions? Thank you.
  • ChipR
    Recognized Expert Top Contributor
    • Jul 2008
    • 1289

    #2
    Try this:
    Code:
    WHERE Hour([dateField]) >= 12 AND Hour([dateField]) < 21

    Comment

    • mcgr0199
      New Member
      • Aug 2009
      • 3

      #3
      Thanks ChipR. I'm new to access so trying to figure it all out. another question for you (this is going to seem dumb), what do I enter into the ([dateField])? If I want temperatures for certain times of day from June15 through August13?

      Comment

      • ChipR
        Recognized Expert Top Contributor
        • Jul 2008
        • 1289

        #4
        [dateField] represents the field from your table or query which contains the date the temperature was taken. The line I provided will limit the results to records that have a [dateField] between 12 and 9pm, and you can limit them further by adding additional clauses with AND, such as:
        Code:
        WHERE Hour([dateField]) >= 12 
          AND Hour([dateField]) < 21
          AND [dateField] >= #6/15/09#
          AND [dateField] <= #8/13/09#
        I didn't test that, but I think it's right.

        Comment

        Working...