alohaaaron
Programmer
Hi, I'm trying to convert a date of this format:
12-5-2008 (m d Y) to 2008-12-5 (Y m d) but when I do the conversion it doesn't display the correct date.
I start with:
$my_date = '12-5-2008';
$my_time = strtotime($my_date);
echo date('Y-m-d',$my_time);
'This displays 2017-10-29 for some reason???
echo date('m-d-Y',$my_time);
'This displays 10-29-2017 for some reason???
If I start with $my_date = '2008-12-5'; //(Y-m-d)
Then the conversion works fine.
12-5-2008 (m d Y) to 2008-12-5 (Y m d) but when I do the conversion it doesn't display the correct date.
I start with:
$my_date = '12-5-2008';
$my_time = strtotime($my_date);
echo date('Y-m-d',$my_time);
'This displays 2017-10-29 for some reason???
echo date('m-d-Y',$my_time);
'This displays 10-29-2017 for some reason???
If I start with $my_date = '2008-12-5'; //(Y-m-d)
Then the conversion works fine.