Really it is working. It is a Time Zone issue. For example if you host on indian server you will get the server GTM. If you are in America for example its dont going to work for you.
I have the same issue because I take a Hosting on USA hosting and the time zone is different. How I solve this? ok I change the time zone on .httaccess making it change the time zone for my installation.
Put this in your .htaccess
php_value date.timezone "Europe/Istanbul" <--- use your zone
or
php_value date.timezone "America/Chicago" <--- use your zone
You can test date is change or not
<?php
echo date('d-m-Y H:i:s');
?>
For time zone list go to the next link
https://www.php.net/manual/en/timezones.php