php modifies the time format of the code

  • 2020-05-05 11:04:28
  • OfStack

Modify the time format:
date("Y-m-d",strtotime($list['pubdate']));
date() converts the time into strtotime for a timestamp.
for two functions is written below
PHP strtotime() function
The strtotime() function parses the date time description of any English text to an Unix timestamp.

Grammar
The strtotime(time,now) parameter describes
time specifies the time string to parse.
now is used to calculate the timestamp of the return value. If the parameter is omitted, the current time is used.


The PHP Date() function formats the timestamp into a more readable date and time.

Grammar
The date(format,timestamp) parameter describes
format required. Specify the format of the timestamp.
timestamp optional. Specify timestamp. The default is the current date and time.

Related articles: