Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Server is the wrong time

Tags:

php

So I am from the UK and have hosting in the US. I contacted my host and said that my server time is set 6 hours behind GMT. They said I need to alter this in my CMS.

How would i go about doing this? Whenever i put now() i am getting the wrong time.

Never seen this before, could anyone offer any suggestions?

like image 208
sark9012 Avatar asked May 20 '10 09:05

sark9012


1 Answers

You can change the timezone using PHP

putenv("TZ=Europe/London");

or if that produces an error:

date_default_timezone_set('Europe/London');

Alternatively if you can gain access to your php.ini (maybe not due to your hosting)

date.timezone = "Europe/London"

Change the setting to the above and you should be ok. Additional to the above - you can set the php.ini with PHP

ini_set('date.timezone', 'Europe/London');

http://www.php.net/manual/en/timezones.europe.php


Edit:

In my rush to answer - you could write GMT instead of Europe/London

like image 186
Glycerine Avatar answered Sep 21 '22 21:09

Glycerine