php get the first and last day of each month instance

WBOY
Release: 2016-07-25 09:13:15
Original
965 people have browsed it

Example, php gets the first and last day of each month. PHP date function date usage.

  1. function getthemonth($date)
  2. {
  3. $firstday = date('y-m-01', strtotime($date));
  4. $lastday = date('y-m-d', strtotime("$firstday +1 month -1 day"));
  5. return array($firstday,$lastday);
  6. }
  7. $today = date("y-m-d");
  8. $day=getthemonth($today);
  9. ?>
Copy code


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