www.webdeveloper.com
Results 1 to 3 of 3

Thread: MYSQL date query

Hybrid View

  1. #1
    Join Date
    Nov 2004
    Posts
    52

    MYSQL date query

    Hi,

    I have dates stored in mysql database in date format 0000-00-00. I cant figure out how to select records where the date stored is 30 days or less ahead of today?

    Thanks

  2. #2
    Join Date
    Jun 2009
    Location
    NY
    Posts
    96
    SELECT * FROM tablename
    WHERE date_field <= DATE_ADD(NOW(), INTERVAL 30 DAY)
    AND date_field > NOW();

  3. #3
    Join Date
    Nov 2004
    Posts
    52
    Great works ..

    I was tring the likes of

    Code:
    SELECT * FROM calendar WHERE starttime BETWEEN NOW() AND DATE_ADD(NOW(), INTERVAL 6 HOUR) AND sendemail = 1
    But wouldnt work?

    I thought it was correct


    Thanks!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles