Alex Rivera | Logout

get UTC time in PHP

Asked 2011-12-28T11:47:48.757
159

How can I get UTC/GMT +/- time stamp using PHP's date() function? For example, if I try

date("Y-m-d H:i:s", time()); 

I will get Unix time stamp; but I need to get UTC/GMT time stamp with string GMT/UTC+/-0400 or GMT/UTC+/-1000 based on local timings.

Edit
Report

1 Answer

139

Using gmdate will always return a GMT date. Syntax is same as for date.

answered 2011-12-28T11:50:27.350

Your Answer