Strtotime with European date format

后端 未结 5 2184
小蘑菇
小蘑菇 2021-01-06 22:02

I\'m trying to use strtotime to convert the following date:

07/09/2009 17:01:27

It\'s the Europe/London timezone format for 7th of September

The func

5条回答
  •  礼貌的吻别
    2021-01-06 22:21

    Change / for -, seems like PHP gets / as American format, and - as European. You can see here:

    $date = "06/10/2011 14:28"; // 6 october 2011 2:28 pm
    $otherDate = "06-10-2011 14:28"; // 6 october 2011 2:28 pm
    
    echo $stamp = strtotime($date) . "
    "; // outputs 1307708880 echo $otherStamp = strtotime($otherDate) . "
    "; // outputs 1317904080 echo date("d-m", $stamp); // outputs 10-06 echo date("d-m", $otherStamp); // outputs 06-10

    http://www.php.net/manual/es/function.strtotime.php#106043

提交回复
热议问题