note 27147 deleted from function.date by sniper

From: Date: Sat, 11 Oct 2003 16:51:09 +0000
Subject: note 27147 deleted from function.date by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-58269@lists.php.net to get a copy of this message
Note Submitter: allen at brooker dot gb dot net ---- A useful code snippet if you want to repeat an operation for the past 12 months (eg. log entry summaries): // What's the current date (YYYY & MM) $date['year'] = date("Y"); // 4 Digit $date['month'] = date("n"); // No leading 0 // For the past 12 months for ($i = 0; $i < 12; $i++) { $current['month'] = date("n") - $i; // Loop round the year when necessary if ($current['month'] < 1) { $current['month'] += 12; $current['year'] -= 1; } }

« previous php.notes (#58269) next »