1

I Want To Change The Date format 'September 2014' to '2014-09-01' in Mysql I tried with Below Query

 SELECT STR_TO_DATE('May 1,2013','%M %d,%Y'); 

its working fine for 'May 1,2013' this format

but i am getting null while using 'September 2014' format

please help me

Dileep Kumar
  • 510
  • 1
  • 4
  • 19

1 Answers1

2
 SELECT STR_TO_DATE(CONCAT('September 2013',',1'),'%M %Y,%D');

EDIT: Mysql expects, all the date fields, so, the above work around is needed, when you don't have the day number beforehand.

Fiddle Demo

Maheswaran Ravisankar
  • 17,652
  • 6
  • 47
  • 69