I'm trying to use timezone_name_from_abbr()
with an offset of GMT+0800, but it doesn't return the expected timezone:
echo "timezone =" . timezone_name_from_abbr('', 8 * 60 * 60, 0) . '<br/>';
According to the documentation this is supposed to work:
If
abbr
doesn't exist then the time zone is searched solely by thegmtOffset
andisdst
.
What I am doing wrong? GMT+0800 is a valid timezone for Asia/Singapore
.
Not a very fancy answer, but it's a bug (Bug #44780 - some time zone offsets not recognized by timezone_name_from_abbr) that has been around for quite a while.
Basically, this particular timezone (and some others) only resolve to a name when you pass an abbreviation, regardless of what the documentation says.
Btw, the return value is false
in the case whereby the function can't resolve the name.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With