The
strtotime() function parses any English text datetime description into a Unix timestamp.
<code>strtotime(<span>time</span>,now)<span> //参数描述</span><span>time</span> 规定要解析的时间字符串。 now 用来计算返回值的时间戳。如果省略该参数,则使用当前时间。</code>
This function expects a string containing a US English date format and attempts to parse it into a Unix timestamp (number of seconds since January 1 1970 00:00:00 GMT) with the value given relative to the now argument time. If this parameter is not provided, the current system time is used.
<code><?php <span>var_dump(<span>strtotime(<span>"now"</span>)</span>)</span>; <span>var_dump(<span>strtotime(<span>"3 October 2005"</span>)</span>)</span>; <span>var_dump(<span>strtotime(<span>"+5 hours"</span>)</span>)</span>; <span>var_dump(<span>strtotime(<span>"+1 week"</span>)</span>)</span>; <span>var_dump(<span>strtotime(<span>"+1 week 3 days 7 hours 5 seconds"</span>)</span>)</span>; <span>var_dump(<span>strtotime(<span>"next Monday"</span>)</span>)</span>; <span>var_dump(<span>strtotime(<span>"last Sunday"</span>)</span>)</span>; <span>var_dump(<span>"今天:"</span>.<span>date(<span>'Y-m-d H:i:s'</span>)</span>)</span>; <span>var_dump( <span>"明天:"</span>.<span>date(<span>'Y-m-d H:i:s'</span>,<span>strtotime(<span>'+1 day'</span>)</span>)</span>)</span>; ?></code>
The running results are as follows
<code><span>int</span>(<span>1452653589</span>) <span>int</span>(<span>1128268800</span>) <span>int</span>(<span>1452671589</span>) <span>int</span>(<span>1453258389</span>) <span>int</span>(<span>1453542794</span>) <span>int</span>(<span>1453046400</span>) <span>int</span>(<span>1452355200</span>) <span>string</span>(<span>26</span>) <span>"今天:2016-01-13 10:53:09"</span><span>string</span>(<span>26</span>) <span>"明天:2016-01-14 10:53:09"</span></code>
The above introduces the interpretation of PHP strings into time, adding one day, adding one month, etc., including the content. I hope it will be helpful to friends who are interested in PHP tutorials.