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
Z is the zone designator for the zero UTC offset. "09:30 UTC" is therefore represented as "09:30Z" or "T0930Z". "14:45:15 UTC" would be "14:45:15Z" or "T144515Z". The Z suffix in the ISO 8601 time representation is sometimes referred to as "Zulu time" because the same letter is used to designate the Zulu time zone.
Carbon::now returns the current date and time and Carbon:today returns the current date.
$date = Carbon\Carbon::createFromFormat('d/m/Y', '11/06/1990');
toISOString() provides millisecond values, whereas . toUTCString() does not.
echo Carbon::now()->toIso8601String();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With