Level 104
There are a lot of microseconds there; try this:
$date = "2017-04-24T07:00:00.000000000Z";
Carbon::createFromFormat("Y-m-d\TH:i:s.uuO", $date);
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
2017-04-24T07:00:00.000000000Z This is my date format what I get from one API.
How can I praise it to normal DB DateTime format?
I have tried:
$datetime = '2017-04-24T07:00:00.000000000Z';
$date1 = \DateTime::createFromFormat('Y-d-m\TH:i:s.zzzZ', $datetime);
$date2 = Carbon::parse('Y-d-m\TH:i:s.zzzZ', $datetime, 'UTC');
$date1->format('Y-m-d H:i:s');
Both give me error - false.
Maybe somehow with regex?
Can someone help me in this?
Please or to participate in this conversation.