note 118608 added to class.datetime
| From: | michael at smith-li dot com | Date: | Thu, 07 Jan 2016 18:47:53 +0000 |
| Subject: | note 118608 added to class.datetime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-204611@lists.php.net to get a copy of this message | ||
DateTime supports microseconds since 5.2.2. This is mentioned in the documentation for the date
function, but bears repeating here. You can create a DateTime with fractional seconds and retrieve
that value using the 'u' format string.
<?php
// Instantiate a DateTime with microseconds.
$d = new DateTime('2011-01-01T15:03:01.012345Z');
// Output the microseconds.
echo $d->format('u'); // 012345
// Output the date with microseconds.
echo $d->format('Y-m-d\TH:i:s.u'); // 2011-01-01T15:03:01.012345
----
Server IP: 72.52.91.14
Probable Submitter: 173.75.236.183
----
Manual Page -- http://php.net/manual/en/class.datetime.php
Edit -- https://master.php.net/note/edit/118608
Del: integrated -- https://master.php.net/note/delete/118608/integrated
Del: useless -- https://master.php.net/note/delete/118608/useless
Del: bad code -- https://master.php.net/note/delete/118608/bad+code
Del: spam -- https://master.php.net/note/delete/118608/spam
Del: non-english -- https://master.php.net/note/delete/118608/non-english
Del: in docs -- https://master.php.net/note/delete/118608/in+docs
Del: other reasons-- https://master.php.net/note/delete/118608
Reject -- https://master.php.net/note/reject/118608
Search -- https://master.php.net/manage/user-notes.php