echo date('Ymt',strtotime('201812'));
The result is: 20181130
依稀往梦似曾见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