PHP date_default_timezone_set() 函数

PHP 教程 · 2019-01-23 19:28:38

实例

设置默认时区:

<?php date_default_timezone_set("Asia/Shanghai"); echo date_default_timezone_get(); ?>

定义和用法

date_default_timezone_set() 函数设置脚本中所有日期/时间函数使用的默认时区。

语法

date_default_timezone_set(timezone);

参数 描述
timezone 必需。规定要使用的时区,比如 "UTC" 或 "Europe/Paris"。合法时区的列表: http://www.php.net/manual/en/timezones.php

技术细节

返回值: 如果 timezone 不合法则返回 FALSE,否则返回 TRUE。
PHP 版本: 5.1+
更新日志: 从 PHP 5.1.2+ 开始,该函数开始验证 timezone 参数。从 PHP 5.3+ 开始,抛出 E_WARNING 而不是 E_STRICT。

点击查看所有 PHP 教程 文章: https://codercto.com/courses/l/5.html

查看所有标签

The Definitive Guide to MongoDB

The Definitive Guide to MongoDB

Peter Membrey、Wouter Thielen / Apress / 2010-08-26 / USD 44.99

MongoDB, a cross-platform NoSQL database, is the fastest-growing new database in the world. MongoDB provides a rich document orientated structure with dynamic queries that you’ll recognize from RDMBS ......一起来看看 《The Definitive Guide to MongoDB》 这本书的介绍吧!

URL 编码/解码
URL 编码/解码

URL 编码/解码

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具