PHP中的date_default_timezone_get()函数
date_default_timezone_get()函数返回默认时区。
语法
date_default_timezone_get(void)
参数
无效-NA
返回
date_default_timezone_get()函数返回一个字符串。
示例
以下是一个例子-
<?php
echo "Old time zone is ". date_default_timezone_get();
$timeZone = 'America/Costa_Rica';
if( date_default_timezone_set( $timeZone) ){
# Now get this time zone.
echo "New time zone is ". date_default_timezone_get();
}
?>输出结果
以下是输出-
Old time zone is UTC New time zone is America/Costa_Rica
示例
让我们看另一个例子-
<?php echo date_default_timezone_get(); ?>
输出结果
以下是输出-
UTC
热门推荐
10 20岁简短生日祝福语
11 英语简短祝福语给学生
12 元旦的祝福语简短 公司
13 国庆简短幽默祝福语
14 生日祝福语 简短独特老弟
15 对儿子祝福语简短精辟
16 3岁孩子祝福语简短
17 祝妹妹毕业祝福语简短
18 生女儿的祝福语简短