设置基准时区,以用于所有其他日期和时间函数。该时区可以是本地(由系统设置)或UTC,您可以使用以下常量之一来定义使用的是哪一个(默认情况下是本地时间):
常量 | 描述 |
---|---|
timezone_local | Use the local time zone as set by the system (the default option) |
timezone_utc | Use Coordinated Universal Time |
date_set_timezone(timezone);
参数 | 类型 | 描述 |
---|---|---|
timezone | 时区常量 | 用于基准时间的时区。 |
N/A
if (date_get_timezone() != timezone_utc)
{
date_set_timezone(timezone_utc);
}
此代码检查游戏的基准时区设置,如果它不是 UTC,然后更改它。