note 13069 deleted from function.mktime by vincent
| From: | vincent@php.net | Date: | Wed, 10 Sep 2003 19:11:53 +0000 |
| Subject: | note 13069 deleted from function.mktime by vincent | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-56015@lists.php.net to get a copy of this message | ||
Note Submitter: witt@mac.com
----
For a calendar-type app, I needed to determine the Sunday and Saturday of the current week, to send
this to the database to get the events scheduled for this week. Here's how:
$sun =
mktime(0,0,0,date("m"),(date("d")-date("w")),date("Y"));
$sat =
mktime(0,0,0,date("m"),(date("d")+(6-date("w"))),date("Y"));
$sun_db = date("Y-m-d", $sun);
$sat_db = date("Y-m-d", $sat);
There may be a better way, but this worked for me with just a minute or two work. Hope this helps
someone!