Walid Mekky
Walid Mekky

Reputation: 3

convert Timezone to mysql date format Y-m-d

I have a timezone date that have been posted to some PHP script. like (Tue Dec 24 2013 00:00:00 GMT+0200 (Egypt Standard Time).

Now all what i need is simply convert that date to match mysql date which in "Y-m-d" format.

Is there any direct function? How to do that?

Upvotes: 0

Views: 740

Answers (1)

John Conde
John Conde

Reputation: 219894

DateTime() will handle this easily.

$dt = new DateTime('Tue Dec 24 2013 00:00:00 GMT+0200');
echo $dt->format('Y-m-d');

Upvotes: 1

Related Questions