Results 1 to 3 of 3

Thread: date + hour

  1. #1
    Join Date
    Oct 2004
    Posts
    4

    Unanswered: date + hour

    I want to get the count of id for a date and hour

    06/09/2004 09:19:00


    for the date = 06/09/2004
    i want the count of ID for the hour = 09


    for access 2000

    SELECT COUNT users.id WHERE users.dates = #06/09/2004# AND hour(users.dates) = #9#

    (i dont want to have to write the 0 of 09)

    it doesn't work

    with variable of course

    SELECT COUNT users.id WHERE users.dates = #[@date]# AND hour(users.dates) = #[@hour]#

    thank you for helping

  2. #2
    Join Date
    Nov 2003
    Location
    LONDON
    Posts
    238
    You need to use the DatePart function (see Help for the full syntax). This returns any part of the date you want such as;

    SELECT COUNT(*) FROM users WHERE (users.date = #06/09/2004#) AND (DatePart("h", users.date) = 9)

    Regards
    Justin

  3. #3
    Join Date
    Dec 2004
    Posts
    277
    or try

    Month(Now) & Day(Now) & Year(Now) & Hour(Time)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •