note 88236 modified in function.mktime by danbrown
| From: | danbrown@php.net | Date: | Fri, 16 Jan 2009 18:33:08 +0000 |
| Subject: | note 88236 modified in function.mktime by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-149331@lists.php.net to get a copy of this message | ||
Add (and subtract) unixtime:
<?php
function utime_add($unixtime, $hr=0, $min=0, $sec=0, $mon=0, $day=0, $yr=0) {
$dt = localtime($unixtime, true);
$unixnewtime = mktime(
$dt['tm_hour']+$hr, $dt['tm_min']+$min, $dt['tm_sec']+$sec,
$dt['tm_mon']+1+$mon, $dt['tm_mday']+$day,
$dt['tm_year']+1900+$yr);
return $unixnewtime;
}
?>
--was--
Add (and subtract) unixtime:
function utime_add($unixtime, $hr=0, $min=0, $sec=0, $mon=0, $day=0, $yr=0) {
$dt = localtime($unixtime, true);
$unixnewtime = mktime(
$dt['tm_hour']+$hr, $dt['tm_min']+$min, $dt['tm_sec']+$sec,
$dt['tm_mon']+1+$mon, $dt['tm_mday']+$day,
$dt['tm_year']+1900+$yr);
return $unixnewtime;
}
http://php.net/manual/en/function.mktime.php