Date format conversion confusion

This should be easy, but I’m getting nowhere. My form mail script records the date and time to separate fields in a CSV file, the date format is ‘d-M-Y’ (15-Feb-2009). Im trying to put the data into a MySQL table, the date and time should go in a column in DATETIME format whch is ‘Y-M-d G:i:s’ (2009-02-15 18:45:23).
I’m having a hard time converting the format. “date_create_from_format” looked like the thing I wanted, but didn’t work, I then realise it’s for PHP5.3.0 and after, my server has PHP5.2.17 which explains why it doesn’t work.
But then how do I convert Feb to 02, without making an array of all the months?
I know in an ideal world the FM script should just write to the MySQL table in the format I want, but I did not write the script.

<?php date_default_timezone_set('Europe/Berlin');
echo date('Y-M-d G:i:s', strtotime('15-Feb-2009 18:45:23')); ?>

That works great, Thanks.
So many date/time functions, making my head spin finding the right one.
Just one correction, it was my mistake in the post. The date format I wanted was Y-m-d, with a small ‘m’ for the month as a number. That was the bit I struggled with, changing the words for numbers.

:slight_smile: Glad it worked out.