0

Why do I get 1969 when I convert the following date to Y-m-d format.

$date1="01/02/2012";
echo date('Y-m-d',$date1);

NOTE: This is php4.

Micheal
  • 2,272
  • 10
  • 49
  • 93

1 Answers1

5

You need to convert the date string to a timestamp:

echo date('Y-m-d', strtotime($date1));
Alex Howansky
  • 50,515
  • 8
  • 78
  • 98