您的位置:首页 > 编程语言 > PHP开发

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

2013-08-29 10:17 323 查看
//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));
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: