I have a date in string format, "Mon, 13 Feb 2017 09:30:00 GMT". I am trying to cast it to Carbon timestamp but I couldn't manage how. How can I use the GMT? What is the proper way?
$date = 'Mon, 13 Feb 2017 09:30:00 GMT';
Carbon::createFromFormat('D, d m Y H:i:s', $date)->toDateTimeString());
You will want to get the time_zone string for example Europe/Paris
and pass it in as a parameter, for example:
Carbon::createFromFormat('D, d M Y H:i:s e', $date, 'Europe/Paris')->toDateTimeString();
If you want GMT just use
Carbon::createFromFormat('D, d M Y H:i:s e', $date, 'UTC')->toDateTimeString();
It is one of the first things that comes up in the Carbon documentation...
Carbon::createFromFormat($format, $time, $tz);