/ Published in: PHP
Obtener las fechas que hay entre dos fechas dadas. No es la diferencia de dÃas o similares, sino las fechas en sÃ.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/** * Returns an array with the dates between to dates given. * * @link http://us3.php.net/manual/en/function.date.php#AEN25217 * * @param mixed $startdate Timestamp or strtotime() recognizeable string * @param mixed $enddate Timestamp or strtotime() recognizeable string * @param string[optional] $format date() format string * @return mixed Array of timestamps or dates if given format */ public static function dates_between($startdate, $enddate, $format=null){ if($startdate > $enddate){ return false; //The end date is before start date } while($startdate < $enddate){ $startdate += 86400; } return $arr; }