kirobo kirobo - 3 months ago 36
PHP Question

Laravel - Carbon Convert Meridian Time to DateTime

I have this DateTime format.

2016-11-22 12:04 PM

I want to convert it to UTC datetime which can be inserted into MysQL.

Can somebody please tell how to do it with carbon?


Set your timezone and add this code something like this.Hope this will be helped you.

$timestamp = '2016-11-22 12:04 PM';
$date = Carbon::createFromFormat('Y-m-d H:i A', $timestamp, 'America/New_York');