PHP头条
热点:

PHP取得上周一、上周日,下周一-PHP源码


[PHP]代码

getNextMonday();
        $lastMonday = $this->getLastMonday();
        $lastSunday = $this->getLastSunday();
        $notice = '下周一('. $nextMonday .')结算'. $lastMonday .'至'. $lastSunday .'的款项。(如遇节假日顺延)';
        return $notice;
    }

    /**
     * 取得下个周一
     * @internal param $time
     */
    private function getNextMonday()
    {
        return date('m月d日',strtotime('+1 week last monday'));
    }

    /**
     * 取得上个周一
     * @return string
     */
    private function getLastMonday()
    {
        if (date('l',time()) == 'Monday') return date('m月d日',strtotime('last monday'));
        
        return date('m月d日',strtotime('-1 week last monday'));
    }

    /**
     * 取得上个周日
     * @return string
     */
    private function getLastSunday()
    {
        return date('m月d日',strtotime('last sunday'));
    }
}

www.phpzy.comtrue/php/36031.htmlTechArticlePHP取得上周一、上周日,下周一-PHP源码 [PHP]代码 getNextMonday(); $lastMonday = $this->getLastMonday(); $lastSunday = $this->getLastSunday(); $notice = 下周一(. $nextMonday .)结算. $lastMonday .至. $lastSunday .的款...

相关文章

PHP之友评论

今天推荐