Setting up timezone via PHP function

you can set the timezone using date_default_timezone_set PHP function. Just check the List of Supported Timezones, find the one which you need, and insert the following code to your website (in most cases, to index.php):

 

<?php
date_default_timezone_set("Asia/Bangkok");
echo date_default_timezone_get();
?>

 

NOTES

  • Don't forget to change "Asia/Bangkok" to the desired timezone

  • PHP documentation on date_default_timezone_set function

  • This change will affect only files. You can also apply a different time zone for the database (1 session)

 

 

Was this answer helpful? 0 Users Found This Useful (0 Votes)