- microtime: documentation ( source)
- floor: documentation ( source)
- date_default_timezone_set: documentation ( source)
- date: documentation ( source)
- setlocale: documentation ( source)
- sprintf: documentation ( source)
<?php
date_default_timezone_set('Europe/Prague');
$time = microtime(true);
$micro_time = sprintf("%06d", ($time - floor($time)) * 1000000);
$date = new DateTime(date('Y-m-d H:i:s.' . $micro_time, $time));
echo $date->format("Y-m-d H:i:s.u") . " - OK\n";
setlocale(LC_NUMERIC, 'cs_CZ.utf8');
$date = new DateTime(date('Y-m-d H:i:s.' . $micro_time, $time));
echo $date->format("Y-m-d H:i:s.u") . " - BAD!\n";