简体   繁体   中英

date_default_timezone_set displays incorrect time

I'm using date_default_timezone_set function to set the timezone but when I echo the time it displays wrong time on local server xampp

date_default_timezone_set ('Africa/Cairo');
echo "<div style='direction:ltr'>".date("Y-m-d / g:i A")."</div>";

the time now is 10:50 am but it displays 9:50 am. So any ideas?

Possible issues:

  • the server's time is not set correctly, test this by confirming that time in the UTC timezone is correct
  • the timezonedb is outdated and the timezone in question has changed its DST rules in the meantime, update your PHP version and/or your timezonedb via PECL

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM