Poiché la stringa della tua data contiene già il fuso orario, non devi fare nulla di speciale:
$when = new DateTime('Sun Jul 13 2014 07:00:00 GMT+0200 (EET)');
echo $when->format('Y-m-d H:i:s');
Come utilmente notato nei commenti, questa stringa contiene in realtà due bit di informazioni sul fuso orario, UTC + 2 e EET (Eastern European Time) e PHP sta sostanzialmente ignorando il secondo. È individuato meglio in questo esempio:
var_dump(new DateTime('Sun Jul 13 2014 07:00:00 GMT+0200 (EET)'), DateTime::getLastErrors());
var_dump(new DateTime('Sun Jul 13 2014 07:00:00 GMT+0200'), DateTime::getLastErrors());
var_dump(new DateTime('Sun Jul 13 2014 07:00:00 (EET)'), DateTime::getLastErrors());
object(DateTime)#1 (3) {
["date"]=>
string(26) "2014-07-13 07:00:00.000000"
["timezone_type"]=>
int(1)
["timezone"]=>
string(6) "+02:00"
}
array(4) {
["warning_count"]=>
int(1)
["warnings"]=>
array(1) {
[34]=>
string(29) "Double timezone specification"
}
["error_count"]=>
int(0)
["errors"]=>
array(0) {
}
}
object(DateTime)#1 (3) {
["date"]=>
string(26) "2014-07-13 07:00:00.000000"
["timezone_type"]=>
int(1)
["timezone"]=>
string(6) "+02:00"
}
array(4) {
["warning_count"]=>
int(0)
["warnings"]=>
array(0) {
}
["error_count"]=>
int(0)
["errors"]=>
array(0) {
}
}
object(DateTime)#1 (3) {
["date"]=>
string(26) "2014-07-13 07:00:00.000000"
["timezone_type"]=>
int(2)
["timezone"]=>
string(3) "EET"
}
array(4) {
["warning_count"]=>
int(0)
["warnings"]=>
array(0) {
}
["error_count"]=>
int(0)
["errors"]=>
array(0) {
}
}
Abbiamo infatti bisogno di spogliarne uno, ad es.:
$js_date_string = 'Sun Jul 13 2014 07:00:00 GMT+0200 (EET)';
// Regular expression is shown for illustration purposes, it's probably wrong!
$tmp_date_string = preg_replace('/ GMT\+\d{4}/ui', '', $js_date_string);
$when = new DateTime($tmp_date_string);
var_dump($when, DateTime::getLastErrors());
echo $when->format('Y-m-d H:i:s');
object(DateTime)#1 (3) {
["date"]=>
string(26) "2014-07-13 07:00:00.000000"
["timezone_type"]=>
int(2)
["timezone"]=>
string(3) "EET"
}
array(4) {
["warning_count"]=>
int(0)
["warnings"]=>
array(0) {
}
["error_count"]=>
int(0)
["errors"]=>
array(0) {
}
}
2014-07-13 07:00:00