Home > Article > Backend Development > PHP method to get the first and last day of a specified month, php last day_PHP tutorial
The example in this article describes how to get the first and last day of a specified month in PHP. Share it with everyone for your reference. The details are as follows:
Copy code The code is as follows: $date = date(time());
$start_date = date('Y-m-d', mktime(00, 00, 00, date('m', strtotime($date)) 1, 01));
$end_date = date('Y-m-d', mktime(23, 59, 59, date('m', strtotime($date)) 2, 00));
I hope this article will be helpful to everyone’s PHP programming design.