PHP DateTime microseconds always returns 0

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);
}

Leave a Comment