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

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

技术教程推荐

零基础学Python -〔尹会生〕

Linux性能优化实战 -〔倪朋飞〕

软件工程之美 -〔宝玉〕

雷蓓蓓的项目管理实战课 -〔雷蓓蓓〕

后端存储实战课 -〔李玥〕

Vim 实用技巧必知必会 -〔吴咏炜〕

张汉东的Rust实战课 -〔张汉东〕

Dubbo源码剖析与实战 -〔何辉〕

超级访谈:对话道哥 -〔吴翰清(道哥)〕

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