当唯一的信息是UTC偏移号时,设置用户的时区。

Is there a timezone 'code' that includes the offset (for example: -7) that the function date_default_timezone_set() would accept? (I only have the offset number, and not something specific like America/Phoenix).

I'm setting timezones based off of Facebook's API, when I extract the user's information.

No. Time zones don't work that way. A time zone offset only applies to a specific point in time. Many time zones share the same offset at various times. Some are indistinguishable from others with an offset alone.

For example, -7 could be MST, or it could be PDT. It might be used with "America/Phoenix", which is on MST year-round. But it might belong to "America/Denver" which would use MST (-7) in the winter and MDT (-6) in the summer. Or it might belong to "America/Los_Angeles", using PST (-8) on the winter and PDT (-7) in the summer.

See also, the timezone tag wiki

Regarding Facebook, it's only giving you the time zone offset as of the user's last login. It is not necessarily even the correct offset for the current moment in time.

you can use a specific array. For example, $timezone = array("-7"=>"America/Phoenix", "-6" =>"oneplace/somewhere" ......... );

Therefore, you can use date_default_timezone_set($timezone[-7]);

Pascal