<p>this code always returns 0 in PHP 5.2.5 for microseconds:</p>

<pre><code>&lt;?php
$dt = new DateTime();
echo $dt-&gt;format("Y-m-d\TH:i:s.u") . "\n";
?&gt;
</code></pre>

<p>Output:</p>

<pre><code>[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
</code></pre>

<p>Any ideas?</p>

This seems to work, although it seems illogical that
http://us.php.net/date
documents the microsecond specifier yet doesn't really support it:
```
```
function getTimestamp()
{
        return date("Y-m-d\TH:i:s") . substr((string)microtime(), 1, 8);
}
```
```