I had a little problem running date(“F j, Y, g:i a”); function, it works fine at the first time but then I notice that it displays different time from my computer.
<?php echo date("F j, Y, g:i a"); ?>
June 10, 2011, 9:35 am
The correct output is June 10, 2011 5:30 pm but instead it’s 7 hours way behind.
Time and date is important in my program because I want to record when and what date-time user log-ins.
There are lots of ways on how to solve this kind of problem, but I’m going to show only 2 solutions by modifying .htaccess or php.ini. Since, I’m from Philippines I’ll be using “Asia/Manila” timezone.
1. Using .htacess:
php_value date.timezone "Asia/Manila"
2. Modifying php.ini
date.timezone = "Asia/Manila"