Jo Smo Jo Smo - 4 months ago 41
PHP Question

How to convert a datetime string to UTC string?

I have a datetime string like this:

`2012-09-03 22:00 Central USA Time`.

and i want to convert it to the UTC time zone.


Use gmdate() and strtotime() :

echo gmdate('Y-m-d H:i', strtotime('2012-09-03 22:00'));

Instead of Central USA Time, use the supported timezones :

The date_default_timezone_get() function will always give you the right timezone