I can get a datetime with microseconds in PHP with a workaround as:
list($usec, $sec) = explode(" ", microtime());
echo date("Y-m-d\TH:i:s", $sec) . "." . floatval($usec)*pow(10,6);
I need the difference with microseconds between two datetimes, can't get a workaround for:
$datetime1 = new DateTime('2013-08-14 18:49:58.606');
$datetime2 = new DateTime('2013-08-14 22:27:19.272');
$interval = $datetime1->diff($datetime2);
echo $interval->format('%h hours %i minutes %s seconds %u microseconds');
DateInterval::format doesn't has the format character %u or equivalent for microseconds.
Anyone knows a workaround for this?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With