note 67337 added to function.date
| From: | pedro at osu1 dot php dot net | Date: | Wed, 07 Jun 2006 10:33:32 +0000 |
| Subject: | note 67337 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-113473@lists.php.net to get a copy of this message | ||
for this post above:
In addition, here's the function I use to get start and end of week (input: week and year,
output: array with start and end date):
<?php
function get_week($w, $y)
{
$df = "Y-m-d"; // date format to return
while (date("w",$fs = mktime(0,0,0,1,$i++,$j)) != 0); // find first sunday in
the given year
$r[0] = $r['start'] = date($df,$w * 604800 + $fs - 518400); // 518,400 sec = 6
days
$r[1] = $r['end'] = date($df,$w * 604800 + $fs); // 604,800 sec/week = 7
days/week * 24 h/day * 3600 sec/h
return $r;
}
?>
$j should be y
----
Server IP: 66.163.161.117
Probable Submitter: 165.165.190.61
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.date.php
Edit -- http://master.php.net/note/edit/67337
Del: integrated -- http://master.php.net/note/delete/67337/integrated
Del: useless -- http://master.php.net/note/delete/67337/useless
Del: bad code -- http://master.php.net/note/delete/67337/bad+code
Del: spam -- http://master.php.net/note/delete/67337/spam
Del: non-english -- http://master.php.net/note/delete/67337/non-english
Del: in docs -- http://master.php.net/note/delete/67337/in+docs
Del: other reasons-- http://master.php.net/note/delete/67337
Reject -- http://master.php.net/note/reject/67337
Search -- http://master.php.net/manage/user-notes.php