How PHP uses strtotime to calculate the number of days between two given dates
This article mainly shows you "how PHP uses strtotime to calculate the number of days between two given dates", the content is simple and easy to understand, organized clearly, I hope to help you solve doubts, let Xiaobian lead you to study and learn "how PHP uses strtotime to calculate the number of days between two given dates" this article bar.
The detailed analysis is as follows:
PHP's strtotime function is used to parse any date-time description of English text into Unix timestamps. This function will use the TZ environment variable (if any) to calculate the timestamp. It returns a timestamp if execution succeeds, FALSE otherwise. Prior to PHP 5.1.0, this function would return-1.
$date1 = date ('Y-m-d');$date2 = '2005-03- 01';$days = (strtotime () - strtotime()) / (60 * 60 * 24);echo "Number of days since '2005-03- 01':$days"; above is "How PHP uses strtotime to calculate the number of days between two given dates" All of this, thank you for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to the industry information channel!