Page 1 of 1

Get time independant from server

Posted: Tue Jan 12, 2010 4:19 am
by klevis miho
How to get the time independant from the server. I want to get the time from my zone (my server is 4 hours before).
If I need to change the server, so do I need to change the time on the scripts.

Do you know of something more efficient?

I'm thinking about an external time or something like that.

Re: Get time independant from server

Posted: Tue Jan 12, 2010 8:29 am
by abushahin
hey im assuming from what you said that u are hosting in a country where it is a different timezone, to be able to change this one way of doing it is that you can set the timezone in your htaccess file to do that you'll need a htaccess file in the root of your server possibly public_html,

Code: Select all

php_value date.timezone "Europe/London"
thats the bit of code that goes into ur .htaccess file, obviously u need to adjust the timezone if its not London. hope that helps

Re: Get time independant from server

Posted: Thu Feb 11, 2010 5:17 am
by klevis miho
I pasted exactly the code you gave me into the .htaccess file in public_html and it gives me an internal server error

Re: Get time independant from server

Posted: Thu Feb 11, 2010 1:38 pm
by abushahin

Code: Select all

php_value date.timezone "Europe/London"
Thats the bit of code in my .htaccess file and it works perfectly, unless your host doesnt allow overwrites with .htaccess then you may have to find al alternative, sorry couldnt help more at this time.

Re: Get time independant from server

Posted: Thu Feb 11, 2010 2:18 pm
by arjan.top

Re: Get time independant from server

Posted: Thu Feb 11, 2010 6:12 pm
by PHPHorizons
I've had a problem where my htaccess file needed a line break at the end of it.

Code: Select all

 php_value date.timezone "Europe/London"
 
Hope that helps.