PHP ��U
前一頁 |  | 下一頁

# XXII. Date and Time Functions

# ��

These functions allow you to get the date and time from the server where your PHP scripts are running. You can use these functions to format the date and time in many different ways.

> 注: Please keep in mind that these functions are dependent on the locale settings of your server. Make sure to take daylight saving time (use e.g. $date = strtotime('+7 days', $date) and not $date += 7*24*60*60) and leap years into consideration when working with these functions.

> 注: The timezones referenced in this section can be found in the 附錄 H.

# �ݨD

�إ߳o�ө��ݭn���~�{�w�C

# �w��

�o�Ǩ�ƬOPHP�֤ߪ�@��A�ݭn�w�˴N�i�ϥΡC

> 注: The latest version of the timezone database can be installed via PECL's timezonedb. For Windows users, a pre-compiled DLL can be downloaded from the PECL4Win site: php_timezonedb.dll.

# ���ɴ�պA

`php.ini`�S�w�q��պA��O�C

# ���ɴ�պA

`php.ini`�]�w�|�v�T�o�Ǩ�ƪ�欰�C

表格 1. Date/Time Configuration Options

Name | Default | Changeable | Changelog
--- | --- | --- | ---
date.default_latitude | "31.7667" | PHP_INI_ALL | Available since PHP 5.0.0.
date.default_longitude | "35.2333" | PHP_INI_ALL | Available since PHP 5.0.0.
date.sunrise_zenith | "90.83" | PHP_INI_ALL | Available since PHP 5.0.0.
date.sunset_zenith | "90.83" | PHP_INI_ALL | Available since PHP 5.0.0.
date.timezone | "" | PHP_INI_ALL | Available since PHP 5.1.0.

For further details and definitions of the PHP_INI_* constants, see the 附錄 G.

�o�̬�²�u�c��O��C

date.default_latitude float

  The default latitude.

date.default_longitude float

  The default longitude.

date.sunrise_zenith float

  The default sunrise zenith.

date.sunset_zenith float

  The default sunset zenith.

date.timezone string

  The default timezone used by all date/time functions if the TZ environment variable isn't set. The precedence order is described in the date_default_timezone_get() page. See 附錄 H for a list of supported timezones.

> 注: The first four configuration options are currently only used by date_sunrise() and date_sunset().

# �귽��

�o�ө��S�w�q���귽�C

# �w��w�q�`��

The following constants are defined since PHP 5.1.1 and they offer standard date representations, which can be used along with the date format functions (like date()).

`DATE_ATOM` (string)

  Atom (example: 2005-08-15T15:52:01+00:00)

`DATE_COOKIE` (string)

  HTTP Cookies (example: Monday, 15-Aug-05 15:52:01 UTC)

`DATE_ISO8601` (string)

  ISO-8601 (example: 2005-08-15T15:52:01+0000)

`DATE_RFC822` (string)

  RFC 822 (example: Mon, 15 Aug 05 15:52:01 +0000)

`DATE_RFC850` (string)

  RFC 850 (example: Monday, 15-Aug-05 15:52:01 UTC)

`DATE_RFC1036` (string)

  RFC 1036 (example: Mon, 15 Aug 05 15:52:01 +0000)

`DATE_RFC1123` (string)

  RFC 1123 (example: Mon, 15 Aug 2005 15:52:01 +0000)

`DATE_RFC2822` (string)

  RFC 2822 (Mon, 15 Aug 2005 15:52:01 +0000)

`DATE_RSS` (string)

  RSS (Mon, 15 Aug 2005 15:52:01 +0000)

`DATE_W3C` (string)

  World Wide Web Consortium (example: 2005-08-15T15:52:01+00:00)

前一頁 | 內容 | 下一頁
cyrus_unbind | 上一層 | checkdate