Revision: 262
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at July 7, 2006 04:47 by sendoa
Initial Code
/**
* 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){
(is_int($startdate)) ? 1 : $startdate = strtotime($startdate);
(is_int($enddate)) ? 1 : $enddate = strtotime($enddate);
if($startdate > $enddate){
return false; //The end date is before start date
}
while($startdate < $enddate){
$arr[] = ($format) ? date($format, $startdate) : $startdate;
$startdate += 86400;
}
$arr[] = ($format) ? date($format, $enddate) : $enddate;
return $arr;
}
Initial URL
Initial Description
Obtener las fechas que hay entre dos fechas dadas. No es la diferencia de dÃas o similares, sino las fechas en sÃ.
Initial Title
Fechas entre dos fechas
Initial Tags
Initial Language
PHP