note 91248 modified in function.strtotime by danbrown
| From: | danbrown@php.net | Date: | Sun, 09 Jan 2011 16:57:33 +0000 |
| Subject: | note 91248 modified in function.strtotime by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-175571@lists.php.net to get a copy of this message | ||
I've noticed that 'first monday' and '1 monday' are not treated equally.
To get the 1st of june 2009 when searching for the first monday:
Use 'first monday' and start from june 0:
<?php
$time= strtotime("first monday ", mktime(0, 0, 0, 06, 0, 2009));
echo "first monday " . date("d-m-Y", $time) . "<br />";
?>
Or use '1 monday' and start from june 1:
<?php
$time= strtotime("1 monday ", mktime(0, 0, 0, 06, 1, 2009));
echo "1 monday " . date("d-m-Y", $time) . "<br />";
?>
Took me a long time to figure this out.
--was--
I've noticed that 'first monday' and '1 monday' are not treated equally.
To get the 1st of june 2009 when searching for the first monday:
Use 'first monday' and start from june 0:
$time= strtotime("first monday ", mktime(0, 0, 0, 06, 0, 2009));
echo "first monday " . date("d-m-Y", $time) . "<br />";
Or use '1 monday' and start from june 1:
$time= strtotime("1 monday ", mktime(0, 0, 0, 06, 1, 2009));
echo "1 monday " . date("d-m-Y", $time) . "<br />";
Took me a long time to figure this out.
http://php.net/manual/en/function.strtotime.php