I am writing PHP app that uses timezones. For land based GPS, I use
date_default_timezone_set();
with correct name like Europe/Dublin
. However, if the GPS location is not land but it is on the sea, there is no timezone name, but time is offseted from UTC. The calculation is aprox. 1 hour for 15 degrees of longitude. I have calculated UTC offset manually, but I am not able to set it to PHP. I am using date
method to print human-readable dates from unix timestamps.
I have found that there are Others timezones names (https://www.php.net/manual/en/timezones.others.php) like Etc/GMT+10
, but the PHP documentation states this:
Warning Please do not use any of the timezones listed here (besides UTC), they only exist for backward compatible reasons, and may expose erroneous behavior.
Is it safe to use the Etc
-based offsets? Or is there any other safe solution? I have not found any. In date_default_timezone_set()
comments someone "uses" this: https://www.php.net/manual/en/function.date-default-timezone-set.php#96551 but it seems very ugly.
I am using PHP 7.1.