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

    Join Date
    Aug 2000
    Location
    Toronto, Ontario, Canada
    Posts
    19
    Rep Power
    0
    Can someone help me out with this at all? I am looking to query and display results from a field that contains the current days date. I am just not sure how to write the proper query to so that the query statement knows what the current date is.

    Thanks all
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Posts
    81
    Rep Power
    14
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
    SELECT *
    FROM my_table
    WHERE date_column = SYSDATE;
    [/code]
    This, of course, assumes that the date_column column is stored as a MySQL DATE type.

  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Posts
    4
    Rep Power
    0
    > date_column = SYSDATE

    oh, alright. How about yesterday? Is it:

    date_column = SYSDATE -1

    ? thanks
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Toronto, Ontario, Canada
    Posts
    19
    Rep Power
    0
    Can someone explain the differnece between CURDATE() and SYSDATE?

    Thanks for the responses so far
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Posts
    81
    Rep Power
    14
    SYSDATE returns a date accurate to the current second (the same as NOW). CURDATE returns a date accurate to the current day. Generally you'll want to use CURDATE when working with just dates, and SYSDATE when you want to deal with times in days -- CURDATE is handy as CURDATE - 1 is yesterday, CURDATE + 1 is tomorrow, etc., whereas with SYSDATE, SYSDATE + 1 is one second from now. Depends on application really. My first response should really have used CURDATE rather than SYSDATE. :-)

Similar Threads

  1. saving query result as date
    By mega1 in forum Visual Basic Programming
    Replies: 0
    Last Post: January 28th, 2004, 04:21 AM
  2. manual query date formating
    By ecads in forum MS SQL Development
    Replies: 8
    Last Post: January 14th, 2004, 04:12 PM
  3. Getting a date from MYSQL using a query
    By Pyros in forum MySQL Help
    Replies: 1
    Last Post: January 10th, 2004, 01:09 PM
  4. How do you sort data coming from a query by date?
    By jinx84 in forum PHP Development
    Replies: 2
    Last Post: January 9th, 2004, 09:05 PM
  5. interesting date query
    By Gnosis in forum MySQL Help
    Replies: 2
    Last Post: January 7th, 2004, 04:34 AM

IMN logo majestic logo threadwatch logo seochat tools logo