note 23866 added to ref.datetime
| From: | nightowl at NOS-PA-M dot uk2 dot net | Date: | Tue, 30 Jul 2002 14:59:15 +0000 |
| Subject: | note 23866 added to ref.datetime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-33995@lists.php.net to get a copy of this message | ||
I wanted to find all records in my database which match the current week (for a call-back function).
I made up this function to find the start and end of the current week :
function week($curtime) {
$date_array = getdate (time());
$numdays = $date_array["wday"];
$startdate = date("Y-m-d", time() - ($numdays * 24*60*60));
$enddate = date("Y-m-d", time() + ((7 - $numdays) * 24*60*60));
$week['start'] = $startdate;
$week['end'] = $enddate;
return $week;
}
--
http://www.php.net/manual/en/ref.datetime.php
http://master.php.net/manage/user-notes.php?action=edit+23866
http://master.php.net/manage/user-notes.php?action=delete+23866
http://master.php.net/manage/user-notes.php?action=reject+23866