PHP gmdate() 函数
PHP 教程
· 2019-01-24 07:13:52
实例
格式化 GMT/UTC 日期和时间,并返回格式化的日期字符串:
<?php
// Prints the day
echo gmdate("l") . "<br>";
// Prints the day, date, month, year, time, AM or PM
echo gmdate("l jS of F Y h:i:s A");
?>
// Prints the day
echo gmdate("l") . "<br>";
// Prints the day, date, month, year, time, AM or PM
echo gmdate("l jS of F Y h:i:s A");
?>
定义和用法
gmdate() 函数格式化 GMT/UTC 日期和时间,并返回格式化的日期字符串。
语法
gmdate(format,timestamp);
| 参数 | 描述 |
|---|---|
| format | 必需。规定输出日期字符串的格式。可使用下列字符:
同时,也可使用下列预定义常量(从 PHP 5.1.0 开始可用):
|
| timestamp | 可选。规定一个整数的 Unix 时间戳。默认是当前的本地时间(time())。 |
技术细节
| 返回值: | 如果成功则返回格式化的日期字符串,如果失败则报 E_WARNING 错并返回 FALSE。 |
|---|---|
| PHP 版本: | 4+ |
| 更新日志: | PHP 5.1.0:有效范围的时间戳是从 1901 年 12 月 13 日 20:45:54 GMT 星期五 到 2038 年 1 月 19 日 03:14:07 GMT 星期二。5.1.0 之前的版本,在某些系统上(例如 Windows)时间戳被限制在从 01-01-1970 到 19-01-2038。 PHP 5.1.1:新增标准日期/时间格式常量,用于指定 format 参数。 |
点击查看所有 PHP 教程 文章: https://codercto.com/courses/l/5.html
Effective JavaScript
David Herman / Addison-Wesley Professional / 2012-12-6 / USD 39.99
"It's uncommon to have a programming language wonk who can speak in such comfortable and friendly language as David does. His walk through the syntax and semantics of JavaScript is both charming and h......一起来看看 《Effective JavaScript》 这本书的介绍吧!