This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Add days to a date. | |
* | |
* @param string $d, date | |
* @param int $ndays, number of days | |
* @param string $format, format date (@see: http://php.net/manual/en/function.date.php) | |
*/ | |
function add_days($ndays, $d, $format="Y-m-d") { | |
$p = $ndays > 1 ? "s" : ""; | |
$nf = strtotime(date($format, strtotime($d)) . " +".$ndays." day". $p); | |
return date($format, $nf); | |
} |
Referencias:
http://www.vision.to/how-to-add-days-weeks-months-to-any-date-.php
http://php.net/manual/en/function.date.php
http://php.net/manual/en/function.strtotime.php
No hay comentarios:
Publicar un comentario