note 66906 added to function.microtime

From: Date: Wed, 31 May 2006 22:22:23 +0000
Subject: note 66906 added to function.microtime
Groups: php.notes 
Request: Send a blank email to php-notes+get-112680@lists.php.net to get a copy of this message
If you're looking for a high-precision timestamp, that is, a string that is formatted like yyyymmddhhiissxxxxxx where xxxxxx is the microsecond portion appended to a standard time stamp, here you go. This is great for renaming uploaded files. <?php function highprecisiontimestamp($l=20){ // returns a date-time-stamp-style string like so: // 20060531144559827180 // This would be for May 31, 2006 at 2:45:59 pm // (plus roughly .827 of a second, give or take) // if you pass in 14 for the length param, the function // returns a standard (mysql) datetimestamp. list($usec, $sec) = explode(" ", microtime()); $microsec = substr($usec,2,6); $rv = date("YmdHis",time()) . $microsec; return substr($rv,0,$l); } ?> ---- Server IP: 216.194.113.175 Probable Submitter: 65.101.60.48 ---- 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.microtime.php Edit -- http://master.php.net/note/edit/66906 Del: integrated -- http://master.php.net/note/delete/66906/integrated Del: useless -- http://master.php.net/note/delete/66906/useless Del: bad code -- http://master.php.net/note/delete/66906/bad+code Del: spam -- http://master.php.net/note/delete/66906/spam Del: non-english -- http://master.php.net/note/delete/66906/non-english Del: in docs -- http://master.php.net/note/delete/66906/in+docs Del: other reasons-- http://master.php.net/note/delete/66906 Reject -- http://master.php.net/note/reject/66906 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#112680) next »