1st day of the Week
| From: | Shaun | Date: | Wed, 20 Oct 2004 10:34:57 +0000 |
| Subject: | 1st day of the Week | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-199864@lists.php.net to get a copy of this message | ||
Hi,
I am trying to use the strtotime function to get dates for the first and
last days of a given week:
<?php
echo date("Y-m-d", strtotime("last monday",
strtotime("2004-10-18"))).'<br>';
echo date("Y-m-d", strtotime("sunday", strtotime("2004-10-18")));
?>
Using the code above works fine until the date input is a Monday then it
outputs the date of the previous Monday. Does anyone know of another way?
Thanks for your help