How can I modify the PHP timezone setting for my website?
How can I modify the PHP timezone setting for my website?
Setting timezone for your website with PHP function
Written by Arnas Damasickis
Updated over a week ago
Your server's global time configuration cannot be changed, but you can use the PHP function date_default_timezone_set to set the timezone for your website.
Here's an example code that sets and checks the currently set timezone:
<?php
date_default_timezone_set("Asia/Bangkok");
echo date_default_timezone_get();
?>
NOTES:
- A list of available PHP timezones can be found here.
- Be sure to check our compilation of articles regarding PHP :)