Home > Article > Backend Development > PHP gets a certain period of the current day
#date() function formats the local date and time and returns the formatted date string.
For example: var_dump(date("Y-m-d"));
'2018-04-05' (length=10)
strtotime(date("Y-m-d" )) 60*60*12;
is the timestamp at 12 noon of the day, so that you can get the start timestamp and end timestamp, and you can use this timestamp as a judgment conditions.
strtotime(date("2018-5-1")) 60*60*12; This is the timestamp at 12 noon on May 1st, or whatever timestamp you need All are available.
strtotime ("next Monday"); What is printed is the timestamp of next Monday, and so on.
Related recommendations:
A pitfall for PHP to obtain remote images
The above is the detailed content of PHP gets a certain period of the current day. For more information, please follow other related articles on the PHP Chinese website!