How can I get the local server\'s timezone without relying on php.ini
or other configuration files?
I am looking for an output similar to the output of
If you're using a Linux/Unix based hosting platform, you could use the output of the date command with the "alphabetic time zone abbreviation" formatter as such:
$systemTimeZone = system('date +%Z');
However, it should be noted that you shouldn't necessarily rely on the system's timezone and that you should instead use date_default_timezone_set (or the date.timezone
php.ini setting) to set the required timezone.