zoukankan      html  css  js  c++  java
  • PHP获取本月时间

    获取本月第一天到最后一天

    function getthemonth($date)
       {
       $firstday = date('Y-m-01', strtotime($date));
       $lastday = date('Y-m-d', strtotime("$firstday +1 month -1 day"));
       return array($firstday,$lastday);
       }
       //$today = date("Y-m-d");
        $today = '2020-2-1';
       $day=getthemonth($today);
       echo "当月的第一天: ".$day[0]." 当月的最后一天: ".$day[1];
       echo "<br/>";

    获取本月第一天到今天

    function getthemonth($date)
       {
       $firstday = date('Y-m-01', strtotime($date));
       $lastday = date('Y-m-d', strtotime($date));
       return array($firstday,$lastday);
       }
       //$today = date("Y-m-d");
        $today = '2020-2-6';
       $day=getthemonth($today);
       echo "当月的第一天: ".$day[0]." 当月的最后一天: ".$day[1];
       echo "<br/>";
  • 相关阅读:
    一位年轻女董事长的忠告:不想穷下去就请看
    Ajax拓展02
    Ajax拓展
    Ajax概念及基础
    PHP了解01
    CSS3新增功能03
    CSS3新增功能02
    CSS3新增功能01
    html5介绍
    jQuery学习03
  • 原文地址:https://www.cnblogs.com/qczy/p/12049960.html
Copyright © 2011-2022 走看看