Home  >  Article  >  Backend Development  >  PHP gets a certain period of the current day

PHP gets a certain period of the current day

不言
不言Original
2018-04-21 13:28:392292browse


#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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn