In my particular case, both the server and the client are the same computer, I'm on localhost. When i echo out the date from the date() function, it displays a totally wrong value, a 11 hours earlier time. I also tried gmdate(), but it displays the date in AM not PM. Is there any way to change the apache server time, so everytime I get it in php, it displays the same as the time on my computer?
EDIT: Sorry for the late edit. I have already set the timezone in the php.ini but it still doesn't work. And I'm sure that my timezone is correct, since I got it from the manual and checked from phpinfo().
The default timezone for PHP is UTC regardless of your server's timezone. This is the timezone used by all PHP date/time functions in your scripts.
Method 1: Using Developer Tools to Change Chrome TimezoneOpen DevTools in Chrome -> Open the Console drawer. Click on the three-dotted menu -> Click on More tools -> Sensors. From the Sensors tab, set the location according to your preference and define the specific timezone.
I believe you are looking for: date_default_timezone_set ( string $timezone_identifier )
Link
You can also set this in your php.ini config.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With