Thread: dates & querys

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Atlanta, Ga, USA
    Posts
    4
    Rep Power
    0
    I am trying to construct a query string that will return a result set between two dates.

    something along the lines of:

    select * from milestone where dueDate > 2000-08-01 && dueDate < 2001-08-01;

    it works when I compart a date to current date :

    select * from milestone where dueDate > CURRENT_DATE;

    but not the first, I even tried using BETWEEN...AND; that returned an empty result set as well

    Any help out there?

    thanks
  2. #2
  3. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Location
    Brussels, Belgium
    Posts
    14,648
    Rep Power
    4493
    You have to put single quotes around your dates. This worked for me

    select * from test where my_date between '1999-1-1' and '2001-1-1';

    ---JH

Similar Threads

  1. Date Formatting to search dates correctly
    By cadams in forum MySQL Help
    Replies: 8
    Last Post: January 12th, 2004, 11:09 PM
  2. SELECT all dates 5 days from now
    By jpluttme in forum MySQL Help
    Replies: 2
    Last Post: July 15th, 2003, 12:26 PM
  3. filling in dates
    By gennyblake in forum MySQL Help
    Replies: 2
    Last Post: July 14th, 2003, 05:19 AM
  4. dates in mysql
    By Ides in forum MySQL Help
    Replies: 1
    Last Post: February 20th, 2003, 10:57 PM
  5. All dates in between 2 dates?
    By Mirax in forum PHP Development
    Replies: 2
    Last Post: January 5th, 2003, 07:29 PM

IMN logo majestic logo threadwatch logo seochat tools logo