当前位置: 首页 > 网络学院 > 服务端脚本教程 > PHP > PHP Date

PHP
PHP 安全邮件
MySQL 介绍
连接 MySQL
创建 MySQL
MySQL 插入记录
MySQL 选择记录
MySQL Where
MySQL Order By
MySQL 记录更新
MySQL 删除记录
PHP ODBC
XML Expat Parser
XML SimpleXML
PHP 数组参考
PHP Calendar
PHP Date
PHP Directory
PHP Filesystem
PHP FTP
PHP HTTP

PHP Date


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-01   浏览: 1046 ::
收藏到网摘: n/a

PHP Date / Time Introduction
PHP日期/时间介绍

The date/time functions allow you to extract and format the date and time on the server.
可以用这些函数得到 PHP 所运行的服务器的日期和时间。可以用这些函数将日期和时间以很多不同方式格式化输出。

Note: These functions depend on the locale settings of the server!
注意:这些函数依赖于服务器的地区设置。


Installation
安装

The date/time functions are part of the PHP core. There is no installation needed to use these functions.
本函数库作为 PHP 内核的一部分,不用安装就能使用。


Runtime Configuration
运行时配置

The behavior of the date/time functions is affected by settings in php.ini.
这些函数的行为受 php.ini 的影响。

Date/Time configuration options:
日期/时间配置选项

Name
名称
Default
默认值
Description
说明
Changeable
可修改范围
date.default_latitude  "31.7667" Specifies the default latitude (available since PHP 5). This option is used by date_sunrise() and date_sunset()
指定默定纬度(自PHP 5)。用于date_sunrise()和 date_sunset()
PHP_INI_ALL
date.default_longitude "35.2333" Specifies the default longitude (available since PHP 5). This option is used by date_sunrise() and date_sunset()
指定默定经度(自PHP 5)。用于 date_sunrise()和 date_sunset()
PHP_INI_ALL
date.sunrise_zenith "90.83" Specifies the default sunrise zenith (available since PHP 5). This option is used by date_sunrise() and date_sunset()
指定默定日出最高点(自PHP 5)。用于 date_sunrise()和 date_sunset()
PHP_INI_ALL
date.sunset_zenith "90.83" Specifies the default sunset zenith (available since PHP 5). This option is used by date_sunrise() and date_sunset()
指定默定日落最高点(自PHP 5)。用于 date_sunrise()和 date_sunset()
PHP_INI_ALL
date.timezone "" Specifies the default timezone (available since PHP 5.1)
指定默定时区(自PHP 5.1)
PHP_INI_ALL


PHP Date / Time Functions
日期/时间函数

PHP: indicates the earliest version of PHP that supports the function.
PHP:最早支持这些函数的PHP版本

Function
函数
Description
说明
PHP
checkdate() Validates a Gregorian date
验证一个格里高里日期
3
date_default_timezone_get() Returns the default time zone
返回一个脚本中所有日期时间函数所使用的默认时区
5
date_default_timezone_set() Sets the default time zone
设定用于一个脚本中所有日期时间函数的默认时区
5
date_sunrise() Returns the time of sunrise for a given day / location
返回给定的日期与地点的日出时间
5
date_sunset() Returns the time of sunset for a given day / location
返回给定的日期与地点的日落时间
5
date() Formats a local time/date
格式化一个本地时间/日期
3
getdate() Returns an array that contains date and time information for a Unix timestamp
返回Unix时间戳的日期/时间信息
3
gettimeofday() Returns an array that contains current time information
返回当前时间
3
gmdate() Formats a GMT/UTC date/time
格式化一个GMT/UTC日期/时间
3
gmmktime() Returns the Unix timestamp for a GMT date
返回GMT日期的UNIX时间戳
3
gmstrftime() Formats a GMT/UTC time/date according to locale settings
根据区域设置格式化GMT/UTC时间/日期
3
idate() Formats a local time/date as integer
将本地时间日期格式化为整数
5
localtime() Returns an array that contains the time components of a Unix timestamp
以数组的形式返回本地时间
4
microtime() Returns the microseconds for the current time
返回当前Unix时间戳和微秒数
3
mktime() Returns the Unix timestamp for a date
返回一个日期的Unix时间戳
3
strftime() Formats a local time/date according to locale settings
根据区域设置格式化本地时间/日期
3
strptime() Parses a time/date generated with strftime()
解析由strftime()函数生成的日期/时间
5
strtotime() Parses an English textual date or time into a Unix timestamp
将任何英文文本的日期时间描述解析为Unix时间戳
3
time() Returns the current time as a Unix timestamp
返回当前的Unix时间戳
3


PHP Date / Time Constants
PHP日期/时间常量

PHP: indicates the earliest version of PHP that supports the constant.
PHP:最早支持这些函数的PHP版本

Constant
常量
Description
说明
PHP
DATE_ATOM Atom (example: 2005-08-15T16:13:03+0000)
原子(如:2005-08-15T16:13:03+0000)
 
DATE_COOKIE HTTP Cookies (example: Sun, 14 Aug 2005 16:13:03 UTC)
HTTP Cookies(如:Sun, 14 Aug 2005 16:13:03 UTC)
 
DATE_ISO8601 ISO-8601 (example: 2005-08-14T16:13:03+0000)
ISO-8601(如:2005-08-14T16:13:03+0000)
 
DATE_RFC822 RFC 822 (example: Sun, 14 Aug 2005 16:13:03 UTC)
RFC 822(如:Sun, 14 Aug 2005 16:13:03 UTC)
 
DATE_RFC850 RFC 850 (example: Sunday, 14-Aug-05 16:13:03 UTC)
RFC 850(如:Sunday, 14-Aug-05 16:13:03 UTC)
 
DATE_RFC1036 RFC 1036 (example: Sunday, 14-Aug-05 16:13:03 UTC)
RFC 1036(如:Sunday, 14-Aug-05 16:13:03 UTC)
 
DATE_RFC1123 RFC 1123 (example: Sun, 14 Aug 2005 16:13:03 UTC)
RFC 1123(如:Sun, 14 Aug 2005 16:13:03 UTC)
 
DATE_RFC2822 RFC 2822 (Sun, 14 Aug 2005 16:13:03 +0000)
RFC 2822(如:Sun, 14 Aug 2005 16:13:03 +0000)
 
DATE_RSS RSS (Sun, 14 Aug 2005 16:13:03 UTC)
RSS(如:Sun, 14 Aug 2005 16:13:03 UTC)
 
DATE_W3C World Wide Web Consortium (example: 2005-08-14T16:13:03+0000)
World Wide Web Consortium[万维网联盟](如:2005-08-14T16:13:03+0000)
 

评论 (0) All

登陆 | 还没注册?