Installation
The date/time functions are part of the PHP core. There is no installation needed to use these functions. Runtime Configuration
The behavior of the date/time functions is affected by settings in php.ini.
Date/Time configuration options:
NameDefaultDescriptionChangeabledate.default_latitude "31.7667"Specifies the default latitude (available since PHP 5). This option is used by date_sunrise() and date_sunset()PHP_INI_ALLdate.default_longitude"35.2333"Specifies the default longitude (available since PHP 5). This option is used by date_sunrise() and date_sunset()PHP_INI_ALLdate.sunrise_zenith"90.83"Specifies the default sunrise zenith (available since PHP 5). This option is used by date_sunrise() and date_sunset()PHP_INI_ALLdate.sunset_zenith"90.83"Specifies the default sunset zenith (available since PHP 5). This option is used by date_sunrise() and date_sunset()PHP_INI_ALLdate.timezone""Specifies the default timezone (available since PHP 5.1)PHP_INI_ALL PHP Date / Time Functions PHP: indicates the earliest version of PHP that supports the function.
FunctionDescriptionPHPcheckdate()Validates a Gregorian date3date_default_timezone_get()Returns the default time zone5date_default_timezone_set()Sets the default time zone5date_sunrise()Returns the time of sunrise for a given day / location5date_sunset()Returns the time of sunset for a given day / location5date()Formats a local time/date3getdate()Returns an array that contains date and time information for a Unix timestamp3gettimeofday()Returns an array that contains current time information3gmdate()Formats a GMT/UTC date/time3gmmktime()Returns the Unix timestamp for a GMT date3gmstrftime()Formats a GMT/UTC time/date according to locale settings3idate()Formats a local time/date as integer5localtime()Returns an array that contains the time components of a Unix timestamp4microtime()Returns the microseconds for the current time3mktime()Returns the Unix timestamp for a date3strftime()Formats a local time/date according to locale settings3strptime()Parses a time/date generated with strftime()5strtotime()Parses an English textual date or time into a Unix timestamp3time()Returns the current time as a Unix timestamp3 PHP Date / Time Constants PHP: indicates the earliest version of PHP that supports the constant.
ConstantDescriptionPHPDATE_ATOMAtom (example: 2005-08-15T16:13:03+0000) DATE_COOKIEHTTP Cookies (example: Sun, 14 Aug 2005 16:13:03 UTC) DATE_ISO8601ISO-8601 (example: 2005-08-14T16:13:03+0000) DATE_RFC822RFC 822 (example: Sun, 14 Aug 2005 16:13:03 UTC) DATE_RFC850RFC 850 (example: Sunday, 14-Aug-05 16:13:03 UTC) DATE_RFC1036RFC 1036 (example: Sunday, 14-Aug-05 16:13:03 UTC) DATE_RFC1123RFC 1123 (example: Sun, 14 Aug 2005 16:13:03 UTC) DATE_RFC2822RFC 2822 (Sun, 14 Aug 2005 16:13:03 +0000) DATE_RSSRSS (Sun, 14 Aug 2005 16:13:03 UTC) DATE_W3CWorld Wide Web Consortium (example: 2005-08-14T16:13:03+0000)