Php Convert time in gmt format

michele picture michele · Jul 3, 2012 · Viewed 14.8k times · Source

I have this string 2012-06-27 16:17:06 and I want to convert it to GMT format.
How can I do that?

Thanks a lot.

Answer

Nikola K. picture Nikola K. · Jul 3, 2012

Use gmdate().
Convert your current date format to UNIX timestamp by using strtotime and then use gmdate($format, $timestamp);