WordPress PHP date
-
I have a small caching script which I’m running between sunrise and sunset. Strangely when setting the current time using PHP, it’s different before from after loading WP:
<?php echo date('Gi'); //correct time include_once $_SERVER['DOCUMENT_ROOT'].'/wp-load.php'; echo date('Gi'); //time off by 2 hours, which is UTC ?>
I have set the correct timezone in WP and the correct time is showing in the main settings screen.
“Universal time (UTC) is 2017-04-09 07:18:12. Local time is 2017-04-09 09:18:12.”
Also the PHP timezone is set correctly on the server.
Strange or usual behaviour?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘WordPress PHP date’ is closed to new replies.