note 67546 added to function.time
| From: | send at mail dot 2aj dot net | Date: | Thu, 08 Jun 2006 18:58:16 +0000 |
| Subject: | note 67546 added to function.time | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-113876@lists.php.net to get a copy of this message | ||
If you want to create a "rounded" time stamp, for example, to the nearest 15 minutes use
this as a reference:
<?php
$round_numerator = 60 * 15 // 60 seconds per minute * 15 minutes equals 900 seconds
//$round_numerator = 60 * 60 or to the nearest hour
//$round_numerator = 60 * 60 * 24 or to the nearest day
// Calculate time to nearest 15 minutes!
$rounded_time = ( round ( time() / $round_numerator ) * $round_numerator );
//If it was 12:40 this would return the timestamp for 12:45;
//3:04, 3:00; etc.
?>
----
Server IP: 64.71.164.2
Probable Submitter: 66.180.125.210
----
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/67546
Del: integrated -- http://master.php.net/note/delete/67546/integrated
Del: useless -- http://master.php.net/note/delete/67546/useless
Del: bad code -- http://master.php.net/note/delete/67546/bad+code
Del: spam -- http://master.php.net/note/delete/67546/spam
Del: non-english -- http://master.php.net/note/delete/67546/non-english
Del: in docs -- http://master.php.net/note/delete/67546/in+docs
Del: other reasons-- http://master.php.net/note/delete/67546
Reject -- http://master.php.net/note/reject/67546
Search -- http://master.php.net/manage/user-notes.php