此函数获取所有其他日期和时间函数所使用的基本时区。该时区可以是本地(由系统设置)或UTC,函数将返回以下常量之一:
时区常数 | |
---|---|
常量 | 描述 |
timezone_local | use the local time zone as set by the system |
timezone_utc | use Coordinated Universal Time |
date_get_timezone();
if (date_get_timezone() != timezone_utc)
{
date_set_timezone(timezone_utc);
}
此代码检查游戏的基准时区设置,如果它不是 UTC,然后更改它。