PHP function to obtain the time period

Nowadays

echo "今天:".date("Y-m-d")."<br>";

  The output results are as follows

Today: 2019-07-18

  

yesterday

echo "昨天:".date("Y-m-d",strtotime("-1 day")), "<br>";

  The output results are as follows

Yesterday: 2019-07-17

  

tomorrow

echo "明天:".date("Y-m-d",strtotime("+1 day")). "<br>";

  The output results are as follows

Tomorrow: 2019-07-19

  

One week after

echo "一周后:".date("Y-m-d",strtotime("+1 week")). "<br>";

  The output results are as follows

A week later: 2019-07-25

strtotime()函数的作用是将日期时间描述解析为 Unix 时间戳

int strtotime ( string time [, int now] )

 

 

Guess you like

Origin www.cnblogs.com/gaojian910/p/11207706.html