Format time to ISO 8601 time with fractional seconds in PHP
Posted on 2008-10-27
I've tried using the date('c', $theTime) and it returns an ISO 8601 formatted time, but removes the fractional seconds from the time.
Here's what I'm using:
$theTime = '2008-08-18 17:59:15.27172';
$date = date('c', strtotime($theTime));
It simply prints:
The time format is correct, accept I want to keep in the fractional seconds. It does not seem to be the call to date() that does it, it's the strtotime call that removes the fractional seconds from what I can tell. Is there an alternative to this?
"It can't be done" is an acceptable aswer if you can show me some documentation somewhere where it states/implies that.