0

I need to convert this date in string format iso format to save in mysql.

string(16) "25/02/2015 11:10"
Fabián
  • 1
  • 2
  • And have you tried anything? I think a quick google search would turn up enough results. Put some effort before asking for help (especially for such a simple task). http://stackoverflow.com/help/how-to-ask – Bogdan Feb 25 '15 at 13:16
  • How many [duplicates of this exact question](http://stackoverflow.com/search?q=format+date+php) have you failed to find? – Mark Baker Feb 25 '15 at 13:16
  • Checkout `DateTime::createFromFormat` – Abhik Chakraborty Feb 25 '15 at 13:16
  • possible duplicate of [How to display a date as iso 8601 format with PHP](http://stackoverflow.com/questions/903203/how-to-display-a-date-as-iso-8601-format-with-php) – Aiken Feb 25 '15 at 13:40

1 Answers1

1
date('Y-m-d H:i:s', strtotime('25-02-2015 11:10'));

You need to use dashes instead of the slashes.

Hazem Taha
  • 1,154
  • 6
  • 18
  • 31