문제

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top