Server time returns value 8 hours ahead |
[eluser]edidiway[/eluser]
I have a strange problem, I am using codeigniter and hosting my application in godaddy server. I tried to get the server time using this syntax Code: date('Y-m-d H:i:s') this is a simple syntax right ? but sometimes the time is right, but sometimes the time returns 8 hours ahead from now. I dont know why this thing can be happened. my .htaccess code is like this : Code: RewriteEngine on can anyone give solution for me ? I have tried called godaddy support, but there is no solution.
[eluser]PravinS[/eluser]
It may be due to server timezone, please check the URL http://php.net/manual/en/timezones.php
[eluser]InsiteFX[/eluser]
Or you can add this to the top of your index.php file, make sure you change the location to yours. Code: /**
[eluser]edidiway[/eluser]
thanks for all your reply, but I think the problem is not in timezone. example, I tried to give this code : Code: date_default_timezone_set("Asia/Jakarta"); //located in index.php the time was accurate sometimes with current setting, but sometimes wrong. Is there any setup I must do ? or is there someone who have experienced the same problem with me ? for your Info I host my web application on godaddy server where the default timezone is : America/Phoenix
[eluser]PravinS[/eluser]
if you have added it just for index.php file, then it will work only for index.php you can add this code in any common php file and include that file in all php pages, so it will work for all php pages
[eluser]Pert[/eluser]
As everything runs through index.php file in CodeIgniter, that's the only place you have to set it. Is it only PHP date function that shows time wrong?
[eluser]edidiway[/eluser]
sorry for the late reply.. @pravins like Pert says, everything in codeigniter run through index.php, so it is enough to set timezone on index.php file @pert not only the date() function shows time wrong, but also mdate() function.. anyone can help me ? I am confuse because I have 2 web application with 2 account on godaddy server, the one is accurate, but the other one is not (even I use the same file and the same code) |
Welcome Guest, Not a member yet? Register Sign In |