recent searches:
include functions ,
variable functions ,
post functions...
If you are new to PHP or just need to refresh your skills, this is the place to start. This series of tutorials will give you the basic knowledge you will need to create a simple PHP website.
PHP is a reflective programming language originally designed for producing dynamic web pages.[1] PHP is used mainly in server-side scripting, but can be used from a command line interface or in standalone graphical applications. Textual User Interfaces can also be created using ncurses.
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.
Note: 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.
Note: The timezones referenced in this section can be found in the Appendix I.
No external libraries are needed to build this extension.
There is no installation needed to use these functions; they are part of the PHP core.
Note: 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.
The behaviour of these functions is affected by settings in php.ini.
Table 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. |
Here's a short explanation of the configuration directives.
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 Appendix I for a list of supported timezones.
Note: The first four configuration options are currently only used by date_sunrise() and date_sunset().
This extension has no resource types defined.
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().
Another Useful functions:
ref.datetime | migration52.datetime |
PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML. If you are new to PHP and want to get some idea of how it works, try the introductory tutorial. After that, check out the online manual, and the example archive sites and some of the other resources available in the links section.