note 51568 deleted from function.date by derick

From: Date: Sun, 15 Jan 2006 12:46:30 +0000
Subject: note 51568 deleted from function.date by derick
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-101841@lists.php.net to get a copy of this message
Note Submitter: oscar at montur dot net ---- About the GetDateArray function below. I think there are much easier ways to do it, using strtotime and date. function GetDateArray($first, $last) { //Convert dates to php format $fst=explode("/", $first); $first=date("Y-m-d", strtotime($fst[2] . "-" . $fst[1] . "-" . $fst[0])); $end=explode("/", $last); $last=date("Y-m-d", strtotime($end[2] . "-" . $end[1] . "-" . $end[0])); //Initialize a today variable $today=$first; while ($today<=$last) { $DateArr[]=$today; $today=date("Y-m-d", strtotime("+1 days", strtotime($today))); } return $DateArr; }

« previous php.notes (#101841) next »