note 68919 deleted from function.time by bobby

From: Date: Wed, 18 Oct 2006 15:07:47 +0000
Subject: note 68919 deleted from function.time by bobby
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-118694@lists.php.net to get a copy of this message
Note Submitter: tania at example dot com ---- <?php // calculate the dates for the start and end of the current week (i.e. Mon and Friday) $days_before_friday = 5 - date("w"); // 5 represents friday, 'w' returns day of the week (0-6) if($days_before_friday == -1) // if today is saturday { $days_before_friday = 6; // get next Fri, rather than previous Fri } $friday = time() + ($days_before_friday * 24 * 60 * 60); // 24 hours; 60 mins; 60secs in a day $monday = $friday - (4 * 24 * 60 * 60); // 4 days; 24 hours; 60 mins; 60secs in a day /* testing code echo "Today is " . date("l j F, Y") ."<br/>"; echo "Days before friday " . $days_before_friday ."<br/>"; echo "Next Fri is " . date("l j F, Y", $friday) . "<br/>"; echo "Last Mon is " . date("l j F, Y", $monday); */ ?>

« previous php.notes (#118694) next »