douxie9471 2011-04-09 05:16
浏览 23
已采纳

PHP - 日期返回错误的值

I have a little bit of code and it doesn't seem to be working correctly.

I'm trying to put it into the correct format for my database. I'm doing the following:

date('Y-m-d H:i:s', strtotime('24/05/2011'));

But every time I echo it, it returns:

1970-01-01 10:00:00
  • 写回答

4条回答 默认 最新

  • dongshi1868 2011-04-09 05:18
    关注

    Just a guess, but try this:

    date('Y-m-d H:i:s', strtotime('24/05/2011 00:00:00'));
    

    After testing it shows this works:

    echo date('Y-m-d H:i:s', strtotime("24-5-2011"));
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?