-2

I have a string like this "Fri Apr 06 02:28:41 2012", how can i convert it to YYYY-mm-dd format using MySQL

IT ppl
  • 2,626
  • 1
  • 39
  • 56
Ajaydhruv
  • 11
  • 1
  • http://stackoverflow.com/questions/3296725/parse-date-in-mysql – Markus Jarderot Apr 09 '12 at 08:31
  • http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_date-format – xkeshav Apr 09 '12 at 08:32
  • The MySQL date format is actually YYYY-MM-DD, but using the str_to_date() and date_format() functions you can accept and generate any date format required. View this link for more information : http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html. – Mez Apr 09 '12 at 08:34

1 Answers1

2
SELECT STR_TO_DATE('Fri Apr 06, 02:28:41 2012','%W %M %d, %H:%i:%s %Y');
mobius
  • 5,104
  • 2
  • 28
  • 41