Fortunately since 5.3.0 there is DateTime::createFromFormat()
. Although it cannot parse the trailing information it is at least able to ignore it using the +
specifier. You don't need that information in order to create a timestamp as you already have the, machine parsable, GMT+0100
.
Example:
$str = "Fri Oct 25 2013 12:04:10 GMT+0100 (GMT Daylight Time)";
$fmt = 'D M d Y H:i:s O+';
$datetime = DateTime::createFromFormat($fmt, $str);
echo $datetime->getTimestamp();
Output:
1382699050