note 67337 deleted from function.date by bjori

From: Date: Wed, 07 Jun 2006 10:45:12 +0000
Subject: note 67337 deleted from function.date by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-113505@lists.php.net to get a copy of this message
Note Submitter: pedro ---- 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

« previous php.notes (#113505) next »