Not able to set the timezone |
[eluser]nirmal.jingar[/eluser]
Do you have any idea how Apache affect the timezone?
[eluser]Otemu[/eluser]
As far as I know it works like this Apache checks for timezone set [Date] ; Defines the default timezone used by the date functions ; http://php.net/date.timezone date.timezone = Europe/Berlin Then this can be easily overridden by setting date_default_timezone_set('Asia/Kolkata'); in your php files or by changing it directly in php.ini date.timezone = Asia/Kolkata Which is why I suggested uninstalling and reinstalling XAMP/WAMP/Apache as maybe there some kind of conflict.
[eluser]nirmal.jingar[/eluser]
Hi Otemu, I am using PHP 5.2.17 (php-5.2.17-Win32-VC6-x86.msi), Apache 2.2.22 (httpd-2.2.22-win32-x86-openssl-0.9.8t.msi) on Windows 7 Enterprise. I have reinstalled the PHP and Apache and added date.timezone = Asia/Kolkata in php.ini I printing the date in my_controller.php constructor date('d-M-Y h:i ![]() ![]()
[eluser]Otemu[/eluser]
Try the following: 1. Check what is displayed as the default time by going to phpinfo() if your not sure how to get to phpinfo create a php file and just include Code: <?php phpinfo(); ?> 2. Scroll down to where it says Default timezone in the phpinfo page and it should show you what is set, if the correct timezone is displayed as Asia/Kolkata then we know apache is handling the timezone correctly and the issue will be with codeigniter If however it is not showing the timezone as Asia/Kolkata then we know that this is an issue with the installation then you should try the following: i. Uninstalling Apache and then try install either wampserver or xampp. ii. Set the time zone again in php.ini date.timezone = Asia/Kolkata and restart the server iii. Check what is displayed as the default time by going to phpinfo() scroll down to Default timezone and it should show you what is set, if the correct timezone is displayed as Asia/Kolkata then hopefully all should work now
[eluser]nirmal.jingar[/eluser]
Using phpinfo it is showing default timezone "Asia/Kolkata", but showing different date and time on codeigniter pages.
[eluser]Otemu[/eluser]
[quote author="nirmal.jingar" date="1354621164"]Using phpinfo it is showing default timezone "Asia/Kolkata", but showing different date and time on codeigniter pages.[/quote] Create another php page outside of codeiginiter framework and echo date and time and see what you get
[eluser]nirmal.jingar[/eluser]
It is showing correct date and time (as per “Asia/Kolkata” timezone) on non-codeigniter page.
[eluser]Otemu[/eluser]
Have you removed all time references within codeigniter now?? There should be nothing changing timezone within codeigniter itself Then try to echo date and time
[eluser]nirmal.jingar[/eluser]
Yes, I have already removed all the references within codeigniter. It is showing wrong date and time on codeigniter pages.
[eluser]Otemu[/eluser]
Download a fresh version of codeigniter, test it with a clean installation and see what happens |
Welcome Guest, Not a member yet? Register Sign In |