-1

Im trying to convert with strtotime dd/mm/aaaa 0:00:00 format date to timestamp.

Im using:

   $a = "27/01/1981 0:00:00";
   $b = str_replace("/","-",$a);
   echo strtotime($b);

But not sure if is the best way Anyone help?

Thx

Pau
  • 21
  • 1
  • 5

1 Answers1

-1
php -r "var_dump(date('Y-m-d H:i:s', strtotime('01/02/2016 0:00:00')));"
string(19) "2016-01-02 00:00:00"

Just make strtotime($var);

jekaby
  • 403
  • 3
  • 13
  • Input format is `dd/mm/aaaa 0:00:00`, not `mm/dd/aaaa 0:00:00`, so this will break dates.... read the question – Mark Baker Nov 03 '17 at 12:35