I have a PHP script that is called in the footer of my blog pages and also at the end of a few stand-alone pages. The exact same script runs, but when called from the blog footer, it returns a different value than it does from the stand-alone pages. The script uses
time()to get a time value.
The output below is what I am seeing. The 9:41 time is correct and is returned by the script when called from the stand-alone (non-blog) pages. The 4:41 time is 7 hours ahead of the server’s local time (which is 9:41) and is returned when the script is called from the blog pages.
Is there some function WordPress uses that resets the time to UTC? If so, how do I circumvent this so my script returns the correct local time?
I’ve tried modifying the time zone in wp-admin > Settings > General Settings but it makes NO DIFFERENCE which timezone I select. The time my script returns is consistently 7 hours ahead – and consistently correct when called from non-blog pages.
May 24 2012 09:41 pm May 24 2012 09:41 pm May 24 2012 09:41 pm May 25 2012 04:41 am May 25 2012 04:41 am May 25 2012 04:41 am
- The topic ‘wordpress affecting time() function’ is closed to new replies.