XX. Date and Time Functions

Introduktion

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.

Not: 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.

Krav

Inga externa bibliotek beh�vs f�r att bygga det till�gg.

Installation

Inga extra installationer beh�vs f�r att anv�nda dessa funktioner; de �r en del av PHP-k�rnan.

Konfiguration under drift

Den h�r utbyggnaden definerar inte n�gra konfigurationsdirektiv i php.ini.

Konfiguration under drift

De h�r funktionernas beteende p�verkas av inst�llningarna i php.ini.

Tabell 1. Date/Time Configuration Options

NameDefaultChangeableChangelog
date.default_latitude"31.7667"PHP_INI_ALLAvailable since PHP 5.0.0.
date.default_longitude"35.2333"PHP_INI_ALLAvailable since PHP 5.0.0.
date.sunrise_zenith"90.83"PHP_INI_ALLAvailable since PHP 5.0.0.
date.sunset_zenith"90.83"PHP_INI_ALLAvailable since PHP 5.0.0.
date.timezone""PHP_INI_ALLAvailable since PHP 5.1.0.
For further details and definitions of the PHP_INI_* constants, see the Appendix H.

H�r f�ljer en kort f�rklaring av konfigurationsdirektiven.

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.

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

Resurstyper

Den h�r utbyggnaden har inte n�gra resurstyper definerade.

F�rdefinerade konstanter

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

DATE_ATOM (string)

Atom

DATE_COOKIE (string)

HTTP Cookies

DATE_ISO8601 (string)

ISO-8601

DATE_RFC822 (string)

RFC 822

DATE_RFC850 (string)

RFC 850

DATE_RFC1036 (string)

RFC 1036

DATE_RFC1123 (string)

RFC 1123

DATE_RFC2822 (string)

RFC 2822

DATE_RSS (string)

RSS

DATE_W3C (string)

World Wide Web Consortium (W3C)

Innehållsförteckning
checkdate -- Validate a Gregorian date
date_default_timezone_get --  Gets the default timezone used by all date/time functions in a script
date_default_timezone_set --  Sets the default timezone used by all date/time functions in a script
date_sunrise --  Returns time of sunrise for a given day and location
date_sunset --  Returns time of sunset for a given day and location
date -- Format a local time/date
getdate -- Get date/time information
gettimeofday -- Get current time
gmdate -- Format a GMT/UTC date/time
gmmktime -- Get Unix timestamp for a GMT date
gmstrftime -- Format a GMT/UTC time/date according to locale settings
idate -- Format a local time/date as integer
localtime -- Get the local time
microtime -- Return current Unix timestamp with microseconds
mktime -- Get Unix timestamp for a date
strftime -- Format a local time/date according to locale settings
strptime --  Parse a time/date generated with strftime()
strtotime -- Parse about any English textual datetime description into a Unix timestamp
time -- Return current Unix timestamp