dongliang1996 2014-07-16 09:20
浏览 79
已采纳

PHP - strftime(忽略分钟和秒)?

I tried to save time in format YYYY-mm-dd 23:59:59 to mysql database column with datetime. I don't understand why minutes and seconds are ignored always 00 ? Thank you very much for help.

PHP:

$time = strftime('%Y-%m-%d %H:%i:%s', time());

Output:

2014-07-16 11:00:00
  • 写回答

4条回答 默认 最新

  • dtx6087 2014-07-16 09:22
    关注

    You can simple use:

    $time = date("Y-m-d H:i:s");
    

    or even better use mysql NOW() function

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?