Home > database >  What is this date format? 2021-10-04T08:19:54.000 04:00
What is this date format? 2021-10-04T08:19:54.000 04:00

Time:11-16

And how can I covert it to 'd.m.Y H:i:s' with php?

gmdate('d.m.Y H:i:s', '2021-10-04T08:19:54.000 04:00')

did not help

CodePudding user response:

The date format is ISO8601 if I'm not mistaken. PHP can parse this using the default DateTime class:

$date = new DateTime('2021-10-04T08:19:54.000 04:00');
$date->format('d.m.Y H:i:s');

CodePudding user response:

For this purpose just use the native DateTime class. It can interpret several formats. Yours looks like ISO8601.

echo (new DateTime('2021-10-04T08:19:54.000 04:00'))->format('d.m.Y H:i:s');

CodePudding user response:

its ISO 8601 date and you can format this easyly with dateTime or carbon. You can find more info here https://www.php.net/manual/en/datetime.format.php

  • Related