note 27147 added to function.date

From: Date: Mon, 25 Nov 2002 10:37:23 +0000
Subject: note 27147 added to function.date
Groups: php.notes 
Request: Send a blank email to php-notes+get-39938@lists.php.net to get a copy of this message
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; } } -- http://www.php.net/manual/en/function.date.php http://master.php.net/manage/user-notes.php?action=edit+27147 http://master.php.net/manage/user-notes.php?action=delete+27147 http://master.php.net/manage/user-notes.php?action=reject+27147

« previous php.notes (#39938) next »