[thelist] SQL Date formating

Beam sbeam at rtint.net
Wed Feb 12 00:26:01 CST 2003


I think what you want is
SELECT *
FROM 100420_gmtr_t
where  date_format(read_date, '%Y-%m-%d') = '2002-12-01'

I dont know why you used LIKE, date_format() will not include the time if you
dont ask it to.

On Tuesday 11 February 2003 10:07 am, Christopher Ditty wrote:
> Can someone point me in the right direction with formating dates in
> mysql query statements?  I am trying to format 12/01/2002 in a mysql
> statement when I do a select.  The end result should be 2002-12-01.
>
> This is the sql statement I am using.
> SELECT *
> FROM 100420_gmtr_t
> where read_date like 'DATE_FORMAT(12/01/2002, %Y-%m-%d)%'
>
> According to the mysql documentation, this should be working but it is
> not.
>
> Chris



More information about the thelist mailing list