If your PHP scripts are in an incorrect time most likely the reason for this is your hosting server is in a different timezone. But if you want to change it, you can do so by adding a line of code in your php.ini file that will determine the correct time you wish to display in your PHP scripts. Read through this article to learn how.
How to Set the PHP Timezone
You need to have a php.ini file to make this work. If you don’t have one yet, please visit this linked guide to learn how to create a php.ini file. Then, follow the steps below to change your PHP timezone.
- Access your File Manager.
- Scroll to public_html folder and locate your php.ini file.
- Right-click on the php.ini file and click Code Edit. A pop-up window will appear, click Edit to continue to the editor page.
Add the following code at the top of your php.ini file.
date.timezone = "US/Central"
Replace US/Central to your preferred time zone. The location you set determines the time that displays in your PHP scripts.
Click Save Changes to update file.
Congratulations! You just changed your time zone for PHP. You can view your PHP information via your phpinfo page. Visit this linked guide to learn how to to create and view phpinfo page. Please let us know if you need any further assistance, or if you have any questions. We’d love to help!
Fantastic...Thank you for your feedback =)
Sorry... Please submit a support ticket or try another search.