This article mainly introduces the method of using strtotime to calculate the number of days between two given dates in PHP. The example analyzes the skills of PHP operation time, which is of great practical value. Friends who need it can refer to it
The example in this article describes how PHP uses strtotime to calculate the number of days between two given dates. Share it with everyone for your reference. The specific analysis is as follows:
PHP’s strtotime function is used to parse the date-time description of any English text into a Unix timestamp. This function will use the TZ environment variable (if available) to calculate the timestamp. It returns a timestamp if the execution is successful, otherwise it returns FALSE. Prior to PHP 5.1.0, this function would return -1.
?
3 4 |
$date1 = date('Y-m-d'); |