note 85701 deleted from function.strtotime by danbrown
| From: | danbrown@php.net | Date: | Mon, 18 May 2009 02:18:04 +0000 |
| Subject: | note 85701 deleted from function.strtotime by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-155641@lists.php.net to get a copy of this message | ||
Note Submitter: espen dot holje at escio dot no
----
Finding the starting date of next week:
strtotime("next week") won't work since it will be interpreted as "current day +
7 days".
Solution: Find current week's first day, then add 7 days:
<?php
$startTsCurrentWeek = mktime(0, 0, 0, date('m'), date('d') -
date('w'), date('Y'));
$startTsNextWeek = $startTsCurrentWeek + (7*86400);
$startTsPreviousWeek = $startTsCurrentWeek - (7*86400);
?>