I need a time which is same in different timezone. For this, I have used gmdate('Y-m-d', 'H:i:s'). But it is giving different time in local server and remote server. My code is following :
$date = gmdate('Y-m-d H:i:s');
var_dump($date);
In localhost I get : 2016-06-13 21:26:11
But in remove server I get : 2016-06-13 08:26:10
Shouldn't these two be same ? What can I do to make them return same time value ?
Regards, Tanvir
Set the correct timezone in your local php.ini
.
gmdate()
returns the UTC time, but it has to know what the system timezone is. If your system hour is 23:26 and you set date.timezone
to Europe/Paris (UTC+2 during summer time), it will calculate UTC time as 21:26.