Simply start the constructor of DateTime
by passing its string as a parameter:
$date = new DateTime('2018-10-23T12:05:18.18UTC0TUE')
And use the method DateTime::format
to format in ISO8601
$date->format(DateTime::ISO8601);
You can use the date
function too:
date(DATE_ISO8601, strtotime('2018-10-23T12:05:18.18UTC0TUE'))
What would this 000-03:00
be?
000-03:00
are actually two things together. 000
is the end of the milliseconds of your date.
-03:00
already refers to the timezone of your date.
If you use the DateTime::getTimezone()
function, you can get the object DateTimezone
of your date.
See:
$date->getTimezone();
The result is:
DateTimeZone Object
(
[timezone_type] => 3
[timezone] => UTC
)
According to the Wikipedia :
[...] is the reference time zone from which all other time zones in the world are calculated.
Check out some date formatting constants in documentation