Take the 2-minute tour ×

how do i search dates using mysql. Database fields are like this:


Monday, 21 December 2009 11:54:16



I have date text field: '21/12/2009'

how do i search date in the database. 'date' field type is varchar and timeurl type is timestamp


share|improve this question
date type is varchar and timeurl is timestamp –  vishnu Feb 17 '11 at 9:36
Fix your table to store dates with the data type date. Never ever store dates as text. –  a_horse_with_no_name Feb 17 '11 at 10:11
add comment

1 Answer

If you are asking about the date format you need to enter in your query it's:

For queries on a DATE column you should enter dates with format 'yyyy-MM-dd'.

For queries on a TIMESTAMP or DATETIME columns you should enter dates with format 'yyyy-MM-dd HH:mm:ss'

MySql is very flexible on this - you can actually use many other formats for insertion and querying as described here.

share|improve this answer
add comment

Your Answer


