note 38165 deleted from function.mktime by tomsommer
| From: | tomsommer@php.net | Date: | Sun, 07 Nov 2004 20:29:40 +0000 |
| Subject: | note 38165 deleted from function.mktime by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-80250@lists.php.net to get a copy of this message | ||
Note Submitter: lmfreitas at weblevel dot org
----
add days to a date or leave $data empty to use system time.
<?php
function add_time ($add,$data=false){
if ($data) $data = strtotime($data);
if ($data) return date ("Y-m-d H:i:s", mktime(
date("H",$data),
date("i",$data),
date("s",$data),
date("m",$data),
(date("d",$data)+$add),
date("y",$data)
));
else return date ("Y-m-d H:i:s", strtotime ("+".$add." day"));
}
?>