Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- date_default_timezone_set("Europe/Rome");
- $today = new DateTime();
- $numDay = date("w");
- //echo "<br>today = ".$today->format('Y-m-d H:i:s');
- switch($numDay){
- //monday
- case 1 :
- $startWeek = $today->format('Y-m-d 00:00:00');
- $endWeek = $today->modify('next sunday')->format('Y-m-d 23:59:59');
- break;
- /*//sunday
- case 0 :
- $startWeek = $today->modify('last monday')->format('Y-m-d 00:00:00');
- $endWeek = $today->format('Y-m-d 23:59:59');
- break;*/
- default:
- $startWeek = $today->modify('last monday')->format('Y-m-d 00:00:00');
- $endWeek = $today->modify('next sunday')->format('Y-m-d 23:59:59');
- break;
- }
- //echo "<br><br>start week = ".$startWeek;
- //echo "<br>end week = ".$endWeek;
- $startMonth = $today->modify('first day of this month')->format('Y-m-d H:i:s');
- $endMonth = $today->modify('last day of this month')->format('Y-m-d 23:59:59');
- //echo "<br><br>start month = ".$startMonth;
- //echo "<br>end month = ".$endMonth;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement