note 103540 modified in function.date by danbrown

From: Date: Tue, 19 Apr 2011 14:43:08 +0000
Subject: note 103540 modified in function.date by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-178970@lists.php.net to get a copy of this message
A simple way to get the closest next Monday <?php function getNextMondayDate() { $ret = date('Y-m-d'); for ($i=1; $i<=7; $i++) { if (date('w',strtotime('+'.$i.' day'))==1) { $ret = date('Y-m-d',strtotime('+'.$i.' day')); break; } } return $ret; } ?> --was-- <?php /* A simple way to get the closest next Monday */ function getNextMondayDate() { $ret = date('Y-m-d'); for ($i=1; $i<=7; $i++) { if (date('w',strtotime('+'.$i.' day'))==1) { $ret = date('Y-m-d',strtotime('+'.$i.' day')); break; } } return $ret; } ?> http://php.net/manual/en/function.date.php

« previous php.notes (#178970) next »