PHP日期和时间函数。 中的 date_defaul

首页 / PHP入门教程 / PHP日期和时间函数。 中的 date_defaul

date_default_timezone_get() - 语法

string date_default_timezone_get ( void );

返回字符串。

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 America/Denver
New time zone is America/Costa_Rica

祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)

技术教程推荐

赵成的运维体系管理课 -〔赵成〕

Java核心技术面试精讲 -〔杨晓峰〕

趣谈网络协议 -〔刘超〕

玩转Spring全家桶 -〔丁雪丰〕

自动化测试高手课 -〔柳胜〕

徐昊 · TDD项目实战70讲 -〔徐昊〕

现代React Web开发实战 -〔宋一玮〕

结构思考力 · 透过结构看思考 -〔李忠秋〕

结构沟通力 -〔李忠秋〕

好记忆不如烂笔头。留下您的足迹吧 :)