0

I am trying to convert the format of this date 25/02/2017 to 2017-02-25. I am using the PHP date function date('Y-m-d',strtotime('25/02/2017')); But the output i receive is 1970-01-01. What should be the problem?

1 Answers1

1

Try this,

echo date('Y-m-d', strtotime(str_replace("/","-","25/02/2017")));
Rahul
  • 18,271
  • 7
  • 41
  • 60