PHP gets a certain period of the current day

不言
Release: 2023-03-24 15:36:02
Original
2254 people have browsed it


#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)
Copy after login

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!

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!