I’ve faced a really funny problem. my server timezone is set to America/New_York (as indicated in phpinfo() and return value of date_default_timezone_get()) and now it is 23:30 PM in New York but when use echo date(h:i) it shows me 7:30 AM , with 8 hours offset!
My server system time also shows 7:30 AM and default timezone is not set in php.ini
Thanks for your help
Sounds simple.
Based on the comments to your question, fix the time on the server and PHP will report the correct time.
If your server is set in America/New_York timezone and PHP is also set to America/New_York, that is, if the server offset matches PHP’s offset, PHP will just output the server’s time.
It’s possible you were assuming that PHP’s date() function is getting the current time from a time server or something; This is not the case.
Bonus
After writing the last part of my answer, I felt like figuring out how get time from an NTP time server, e.g.,
time.apple.com