Funkcje te pozwalają Tobie pobrać datę i czas z serwera na którym uruchomione są Twoje skrypty. Możesz uzyć tych funkcji do formatowania daty i czasu na wiele różnych sposobów.
Notatka: Proszę pamiętać, że poniższe funkcje są zależne od lokalnych ustawień danego serwera. Upewnij się, że bieżesz czas zimowy (użyj np. $date = strtotime('+7 days', $date), a nie $date += 7*24*60*60) i lata przestępne pod uwagę kiedy pracujesz z tymi funkcjami.
Notatka: Strefy czasowe do których odwołujemy się w tym rozdziale możesz znaleźć w Dodatek H.
Do zbudowania tego rozszerzenia nie są wymagane żadne zewnętrzne biblioteki.
By używać tych funkcji, nie trzeba niczego instalować. Są one częścią jądra PHP.
Notatka: Najnowszą wersję bazy danych stref czasowych możesz zainstalować poprzez PECL timezonedb. Dla użytkowików Windows, prekompilowana biblioteka DLL może być pobrana ze strony PECL4WIN: php_timezonedb.dll.
To rozszerzenie nie definiuje posiada żadnych dyrektyw konfiguracyjnych w pliku php.ini.
Na działanie tych funcji wpływają ustawienia zawarte w pliku php.ini.
Tabela 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. |
Oto krótkie wyjaśnienie dyrektyw konfiguracji.
date.default_latitude
floatThe default latitude.
date.default_longitude
floatThe default longitude.
date.sunrise_zenith
floatThe default sunrise zenith.
date.sunset_zenith
floatThe 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 Dodatek H for a list of supported timezones.
Notatka: The first four configuration options are currently only used by date_sunrise() and date_sunset().
To rozszerzenie nie posiada żadnych rodzajów zasobów.
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()).
Atom (example: 2005-08-15T15:52:01+00:00)
HTTP Cookies (example: Monday, 15-Aug-05 15:52:01 UTC)
ISO-8601 (example: 2005-08-15T15:52:01+0000)
RFC 822 (example: Mon, 15 Aug 05 15:52:01 +0000)
RFC 850 (example: Monday, 15-Aug-05 15:52:01 UTC)
RFC 1036 (example: Mon, 15 Aug 05 15:52:01 +0000)
RFC 1123 (example: Mon, 15 Aug 2005 15:52:01 +0000)
RFC 2822 (Mon, 15 Aug 2005 15:52:01 +0000)
Same as DATE_ATOM (since PHP 5.1.3)
RSS (Mon, 15 Aug 2005 15:52:01 +0000)
World Wide Web Consortium (example: 2005-08-15T15:52:01+00:00)
Following constants exists since PHP 5.1.2 and specify a format returned by functions date_sunrise() and date_sunset().
Poprzedni | Spis treści | Następny |
cyrus_unbind | Początek rozdziału | checkdate |