I want to convert the date format which was coming from a third-party API The date time format which I got from third-party API is July, 17 2020 09:29:00-0500 and I want to convert it in this format 2022-07-17 09:29:00-0500.
CodePudding user response:
I got the answer. I hope it will help others
use Carbon\Carbon;
Carbon::createFromFormat('M, d Y H:i:sT','July, 17 2020 09:29:00-0500')->format('Y-m-d H:i:s');