I have the following Iso8601 date-time string 2018-03-12T10:34:15-0200 and after I parse it 
Carbon::parse("2018-03-21T10:34:15-0200", 'UTC')
and save it to mysql db datetime column I have 2018-03-21 10:34:15 so I've lost the -0200 hours difference with UTC timezone.
Any ideas how to solve it the right way?
You don't need to pass time zone as a second parameter to parse function. Time zone is already part of date string. If you need to save date in UTC just convert it to UTC timezone after parsing like so:
Carbon::parse("2018-03-21T10:34:15-0200")->setTimezone('UTC')
Converted date will be: 2018-03-21 12:34:15.0 UTC (+00:00)
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