note 13595 added to function.mktime.php
| From: | johnjc at lineone dot net | Date: | Fri, 22 Jun 2001 23:10:59 +0000 |
| Subject: | note 13595 added to function.mktime.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-14579@lists.php.net to get a copy of this message | ||
witt, about a month ago, made a good addition to the documentation when he posted code showing how
to get future dates using mktime() and date(), which manual says you can do but offers no examples.
However, the code he posted gives you next Saturday and last Sunday, which I don't think was
what was intended. But thanks again to witt because he made me think, too. :)
To get the dates for the next weekend, at any time during the week, you can use the code below.
(I'm in Europe and my server is in the US so gmmktime() and gmdate() are more useful to me.
$sun =
gmmktime(0,0,0,gmdate("m"),(gmdate("d")+(7-gmdate("w"))),gmdate("Y"));
$sat =
gmmktime(0,0,0,gmdate("m"),(gmdate("d")+(6-gmdate("w"))),gmdate("Y"));
http://www.php.net/manual/en/function.mktime.php