this code always returns 0 in PHP 5.2.5 for microseconds:
<?php $dt = new DateTime(); echo $dt->format('Y-m-d\TH:i:s.u') . '\n'; ?>
Output:
[root@www1 ~]$ php date_test.php 2008-10-03T20:31:26.000000 [root@www1 ~]$ php date_test.php 2008-10-03T20:31:27.000000 [root@www1 ~]$ php date_test.php 2008-10-03T20:31:27.000000 [root@www1 ~]$ php date_test.php 2008-10-03T20:31:28.000000
Any ideas?
This seems to work, although it seems illogical that http://us.php.net/date documents the microsecond specifier yet doesn’t really support it: