note 93408 added to function.strtotime
| From: | chris at teamsiems dot com | Date: | Tue, 08 Sep 2009 17:20:27 +0000 |
| Subject: | note 93408 added to function.strtotime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-160309@lists.php.net to get a copy of this message | ||
Adding to what Merlin at silvercircle dot org said, it took me a while to notice that strtotime
starts searching from just after midnight of the first day of the month. So, if the month starts on
the day you search for, the first day of the search is actually the next occurrence of the day.
In my case, when I look for first Tuesday of the current month, I need to include a check to see if
the month starts on a Tuesday.
<?php
if (date("l", strtotime("$thisMonth $thisYear"))=='Tuesday') {
echo "<p>This month starts on a Tuesday. Use \"$thisMonth $thisYear\" to
check for first Tuesday.</p>\n";
} else {
echo "<p>This month does not start on a Tuesday. Use \"first tuesday $thisMonth
$thisYear\" to check for first Tuesday.</p>\n";
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 128.194.248.252
----
Manual Page -- http://www.php.net/manual/en/function.strtotime.php
Edit -- https://master.php.net/note/edit/93408
Del: integrated -- https://master.php.net/note/delete/93408/integrated
Del: useless -- https://master.php.net/note/delete/93408/useless
Del: bad code -- https://master.php.net/note/delete/93408/bad+code
Del: spam -- https://master.php.net/note/delete/93408/spam
Del: non-english -- https://master.php.net/note/delete/93408/non-english
Del: in docs -- https://master.php.net/note/delete/93408/in+docs
Del: other reasons-- https://master.php.net/note/delete/93408
Reject -- https://master.php.net/note/reject/93408
Search -- https://master.php.net/manage/user-notes.php