bool date_default_timezone_set ( string $timezone_identifier )
它设置脚本中所有日期/时间函数使用的默认时区。
timezone_identifier - 有效的时区字符串。
如果TIMEZONE_IDENTIFIER无效,则返回FALSE,否则返回TRUE。
链接:https://www.learnfk.comhttps://www.learnfk.com/php/php-function-default-timezone-set.html
来源:LearnFk无涯教程网
<?php echo "Old time zone is ". date_default_timezone_get(). "\n"; $timeZone='America/Costa_Rica'; if( date_default_timezone_set( $timeZone) ){ # Now get this time zone. echo "New time zone is ". date_default_timezone_get(). "\n"; } ?>
这将产生以下输出-
Old time zone is America/Denver New time zone is America/Costa_Rica
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)