I get the date of this format

string(10) "19 05 2016" 

I need to convert it to unix format so I try

 var_dump(strtotime($post["Serial"]["dataseria"])) 

getting

 bool(false) 

why not tell me? And how to correct.

    1 answer 1

    Apparently, your date does not match the format expected by the strtotime function. I think it is necessary to specify the format explicitly. For example:

     $date = \DateTime::createFromFormat('dm Y', '19 05 2016'); echo($date->getTimestamp()); 

    Working example on IDEOne.

    • bool (false) receive - Sergalas
    • So you are doing something wrong (the code in the answer is working, the link to the proof is also there). - Dmitriy Simushev