PHP - How to set the timezone? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

PHP - How to set the timezone?

Hi, I have written a PHP code for messages for each day. https://code.sololearn.com/wDXv92qsPo5f/#php The main part needs the timezone to display the correct day. For my code, I have set it like this: // Time zone for right time date_default_timezone_set('Asia/Dubai'); But as you can see, this is set to Asia timezone. Ppl in the USA or UK will not get the right message for the day. So how do I fix this timezone so that no matter which server location you are at, the time of day is right. Thanx for reading

18th Apr 2018, 8:11 AM
Nft
2 Answers
+ 2
It's OK, Dubai is in Asia (http://php.net/manual/en/timezones.asia.php). You can try with the "Australia/Sydney" timezone to check the impact. For me it works. For info, here the list of timezones: http://php.net/manual/en/class.datetimezone.php#datetimezone.constants.asia
18th Apr 2018, 2:59 PM
jerome
0
Thank u Jerome.
18th Apr 2018, 5:18 PM
Nft