|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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
|
|||
|
|||
|
<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. |
|
#3
|
|||
|
|||
|
> date_column = SYSDATE
oh, alright. How about yesterday? Is it: date_column = SYSDATE -1 ? thanks |
|
#4
|
|||
|
|||
|
Can someone explain the differnece between CURDATE() and SYSDATE?
Thanks for the responses so far |
|
#5
|
|||
|
|||
|
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. :-)
|
![]() |
| Viewing: Dev Shed Forums > Databases > MySQL Help > Query By Today's Date |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|