PHP中的date_default_timezone_set()函数
date_default_timezone_set()函数设置默认时区。
语法
date_default_timezone_set(timezone)
参数
时区-要使用的时区,例如“UTC”或“欧洲/巴黎”。
返回
如果时区无效,则date_default_timezone_set()函数将返回FALSE。否则为TRUE。
示例
以下是一个例子-
<?php
date_default_timezone_set("Asia/Kolkata");
echo date_default_timezone_get();
?>输出结果
Asia/Kolkata
示例
让我们看另一个例子-
<?php
date_default_timezone_set('Asia/Singapore');
$obj= date_default_timezone_get();
if (strcmp($obj, ini_get('date.timezone'))){
echo 'No match!';
} else {
echo 'Match!';
}
?>输出结果
No match!
热门推荐
1 训练狗狗基础
2 怎么训练狗狗笑
3 怎么训练狗狗卧下
4 上海狗狗训练基地
5 训练狗狗排便
6 狗狗基础训练
8 如何训练狗狗装死
9 狗狗站姿训练
10 狗狗训练用品
11 训练狗狗吧
12 狗狗要怎么训练
13 怎么训练狗狗玩球
14 训练狗狗唤回
15 狗狗训练躺下
16 狗狗训练指令
17 狗狗的训练技巧
18 狗狗不好训练