dongyue9864 2015-06-18 12:16
浏览 59
已采纳

具有零小时和零分钟的PHP strtotime函数会产生意外结果

why it is giving me wrong result when convert the time is 00:00. its

date_default_timezone_set("Asia/Karachi");
echo  date("G:m", strtotime("00:00"));
echo  date("G:m", strtotime("00:06"));

Output:

0:06
0:06
  • 写回答

1条回答 默认 最新

  • duanchong3075 2015-06-18 12:20
    关注

    Change:

    "G:m"
    

    to

      "G:i" or "H:i"
    

    m means month, not minute (hence you see 06 for June).

    G is for hours 0-23 without preceding zeros

    H is for hours 00-23 with preceding zeros

    http://php.net/manual/en/function.date.php

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?