search

Home  >  Q&A  >  body text

Notice warning appears when formatting timestamp field in PHP. How to solve it?

You can see that the correct results are output, but a warning appears. How to solve it?

无标题.png

code show as below:

微信截图_20190221151255.png

在远处在远处2165 days ago1013

reply all(2)I'll reply

  • 在远处

    在远处2019-02-21 15:27:41

    It turns out that what is taken out seems to be in time format, but is actually a string. Use strtotime() to solve the problem.

    The code is posted below:

    $dataMonth=date('m',strtotime($row['creation time'])) ;

    reply
    0
  • Cancelreply