标签:php
<?php $strTime = ‘2015-06-28 19:20:58‘; $middletime = strtotime($strTime); $week = date(‘w‘,$middletime); if ($week == 0) { $week = 7; } $monday = date(‘Y-m-d‘, strtotime(‘+‘ . 1 - $week . ‘ days‘,$middletime)) . ‘ 00:00:00‘; //星期一 $sunday = date(‘Y-m-d‘, strtotime(‘+‘ . 7 - $week . ‘ days‘,$middletime)) . ‘ 23:59:59‘; //星期日 echo $monday.‘<br/>‘; echo $sunday;
php 小代码(2)-----给定一个字符串时间得到其时间所在的当周的周一及周日时间
标签:php
原文地址:http://quietnight.blog.51cto.com/7163892/1678779