Carbon parse to ISO8601

Aladin Small picture Aladin Small · Sep 26, 2018 · Viewed 19.5k times · Source

I am trying to get the current time and format it like:

"2018-09-26T21:40:29+02:00"

But when I try:

$isoDate = \Carbon\Carbon::now()->format('c');

as I understood passing a c to format function will parse it to iso8601 but clearly thats not the case.

Any help on how to parse current time to ISO8601 OR 20181001T094006Z

Answer

Nurdin Aidanov picture Nurdin Aidanov · May 16, 2019
echo Carbon::now()->toIso8601String();