现在的位置: 首页 > 综合 > 正文

php 根据指定日期,求出该日期所在周的始末时间和所在月的始末时间

2013年03月24日 ⁄ 综合 ⁄ 共 484字 ⁄ 字号 评论关闭
//the Saturday of this week
$lastday=date("Y-m-d",strtotime("2013-08-28 Saturday"));
echo $lastday;
//the first day of this week
$endlastday=date("Y-m-d",strtotime("2013-09-27 Saturday"));
$endfirstday=date("Y-m-d",strtotime("{$endlastday} -6 days"));
echo $endfirstday;
//the last day of this month
$date = "2013-08-23"; 
$end_date = date('Y-m-d', mktime(23, 59, 59, date('m', strtotime($date))+1, 00));
echo $end_date;
//the first day of this month
$firstDayOfThisMonth = date('Y-m-01',mktime(0,0,0,date('m',strtotime($date))+1,00));

抱歉!评论已关闭.