Date format

If that date is stored in a database like this “2011-02-27 12:51:25”
I want to search history, where history is written in the text field in this format
“2011-02-27”
I tried searching in this format “2011-02-27” did not retrieve any fields
any help?


SELECT this FROM that WHERE DATE(column) = '2011-02-27'

:slight_smile:

This method does not retrieve any data

Are you storing the data as DATETIME ?

yes,in this format “2011-02-27 12:51:25”

Can you post the output of this command please?


SHOW CREATE TABLE table

are you ~sure~ you’re using a DATETIME column?

why did you say a text field, then?

    $sqls ="select * from logs where timestamp between'$dst' and  '$dto' ";  

this is syntax i used but not work

i used textfield to insert the date on which I want to search for

You’re column datatype should be [URL=“http://dev.mysql.com/doc/refman/5.0/en/datetime.html”]DATETIME.

no it’s timestamp

So you are not storing it as DATETIME, as you previously said.

is it TIMESTAMP or INTEGER ???

some people use unix timestamps, which of course are integers, stored in INTEGER columns

in any case, you can easily resolve this issue by letting us see the table – please do the SHOW CREATE TABLE as previously requested