note 68310 added to function.time
| From: | STaRDoGGCHaMP at osu1 dot php dot net | Date: | Fri, 21 Jul 2006 18:34:14 +0000 |
| Subject: | note 68310 added to function.time | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-115020@lists.php.net to get a copy of this message | ||
This function formate a timestamp into days, hours, minutes and seconds.
e.g the time until your birthday.
<?php
function formatetimestamp($until){
$now = time();
$difference = $until - $now;
$days = floor($difference/86400);
$difference = $difference - ($days*86400);
$hours = floor($difference/3600);
$difference = $difference - ($hours*3600);
$minutes = floor($difference/60);
$difference = $difference - ($minutes*60);
$seconds = $difference;
$output = "You have to wait $days Days, $hours Hours, $minutes Minutes and $seconds Seconds
until this Day.";
return $output;
}
//int mktime ( [int hour [, int minute [, int second [, int month [, int day [, int year [, int
is_dst]]]]]]] )
echo formatetimestamp(mktime(0,0,0,12,31,2006)); //output: e.g "You have to wait 162 Days, 4
Hours, 38 Minutes and 46 Seconds until this Day"
?>
----
Server IP: 66.163.161.117
Probable Submitter: 84.165.87.170
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.time.php
Edit -- http://master.php.net/note/edit/68310
Del: integrated -- http://master.php.net/note/delete/68310/integrated
Del: useless -- http://master.php.net/note/delete/68310/useless
Del: bad code -- http://master.php.net/note/delete/68310/bad+code
Del: spam -- http://master.php.net/note/delete/68310/spam
Del: non-english -- http://master.php.net/note/delete/68310/non-english
Del: in docs -- http://master.php.net/note/delete/68310/in+docs
Del: other reasons-- http://master.php.net/note/delete/68310
Reject -- http://master.php.net/note/reject/68310
Search -- http://master.php.net/manage/user-notes.php