current_time function incorrect in plugin and PHP, not in WordPress admin

I had to reboot my server due to recurring server errors (which I couldn't find a reason for). Since rebooting, echoing current_time( 'timestamp', true ) shows the time as 14 hours before my current timezone (GMT). As does echoing time(). However, if I go to “Settings General” in WordPress, the correct time and timezone are showing.

This was all working perfectly before the reboot. How do I fix this? I have tried setting the PHP timezone via an .ini file, which made no difference. The server itself is showing the correct time.

Topic timestamp php timezones server Wordpress

Category Web


true is for GMT time, try removing it.

current_time( 'timestamp' );

https://developer.wordpress.org/reference/functions/current_time/

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.