Home  >  Q&A  >  body text

php time processing

echo date('Ymt',strtotime('201812'));


The result is: 20181130


## I don’t know why this is the result instead of 20181231. I hope you guys can give me some answers.


思何思何2197 days ago1202

reply all(1)I'll reply

  • 依稀往梦似曾见

    依稀往梦似曾见2018-11-06 18:46:17

    strtotime This function means generating a timestamp. If strtotime(' -1days') is like this, it is the timestamp of this time yesterday. If you want to output the date, time, minutes and seconds. echo date('Y-m-d H:i:s'); or echo date('Y-m-d H:i:s',strtotime('-1days')); You can also replace now This function has more parameters. Go read the manual

    reply
    0
  • Cancelreply