forked from docker-php/docker-php-api
-
-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
$object->setStart(\DateTime::createFromFormat('Y-m-d\\TH:i:sP', $data['Start'])); |
Here docker outputs:
"Health": {
"Status": "healthy",
"FailingStreak": 0,
"Log": [
{
"Start": "2023-02-14T16:56:23.106704411+01:00",
"End": "2023-02-14T16:56:23.446917777+01:00",
"ExitCode": 0,
"Output": "somelog"
},
]
}
Notice the microseconds has 9 digits.
Even parsing this with "Y-m-d\TH:i:s.uP" gives false as u
in php can only have a max of 6 digits.
php > var_dump(\DateTime::createFromFormat('Y-m-d\TH:i:s.uP', "2023-02-14T17:00:29.14396576+01:00"));
php shell code:1:
bool(false)
To make it work we could parse it with uu
, but of course it's not correct, but it does dismiss the errors:
php > var_dump(\DateTime::createFromFormat('Y-m-d\TH:i:s.uuP', "2023-02-14T17:00:29.14396576+01:00"));
php shell code:1:
class DateTime#1 (3) {
public $date =>
string(26) "2023-02-14 17:00:29.760000"
public $timezone_type =>
int(1)
public $timezone =>
string(6) "+01:00"
}
I know this is generated by janephp, but it's a very specific case.
Metadata
Metadata
Assignees
Labels
No labels