Take the tour ×  I am having a problem in mysql query, I have
date saved in database in this format :  Wed, 26 Oct 2011
01:25:35 EDT  I want to sort the rows by date but this date
format is not letting me do it. I have tried Date_FORMAT AND
STR_TO_DATE function but couldn't get it working, could you
please help me solve this?  share|improve this question add
comment  2 Answers  up vote 0 down vote accepted  Assuming
you've modified your tables so you've got the original date
field ('olddate') and want to put the reformatted 'native' date
into a new field ('newdate'), then:  UPDATE yourtable SET
newdate = STR_TO_DATE(olddate, '%a, %e %b %Y %H:%i:%s')
however, MySQL does not store timezone information in its
date/time fields, so you'd have to convert the EDT stuff to
whatever TZ is desired (UTC?).  Once converted to native format,
you'd do your sorting with:  ORDER BY YEAR(newdate)
share|improve this answer i made a query just by using the mysql
STR_TO_DATE function and it really worked. thanks for helping
me.