php获取本周日期和下周日期
<?php
/**
- 取得下周一时的结算区间
*/
class Project_View_Helper_TaskNotice
{
/**
* @return string
*/
public function TaskNotice() {
$nextMonday = $this->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'));
}
}
没毛病 php自带日期处理函数真的是强大!!!
- 上一篇: 腾讯云智聆口语评测bug
- 下一篇: PHP goto特性使用及心得与本周与其他周日期获取