Symbol |
Description |
---|---|
|
|
|
|
|
Swatch Internet Time (between |
|
Date in ISO 8601 format |
|
Day of month (from |
|
Day of week (from |
|
Month (from |
|
Hour (from |
|
Hour (from |
|
Hour (from |
|
Hour (from |
|
Minutes (from |
|
Whether date is in DST ( |
|
Day of month (between |
|
Day of month (from |
|
Whether date is in a leap year ( |
|
Month (from |
|
Month (from |
|
Month (from |
|
Difference to GMT (for example, |
|
Date in RFC 2822 format |
|
Seconds (from |
|
Ordinal suffix for the day of month ( |
|
Number of days in the provided month (from |
|
Time zone of server (for example, |
|
Epoche value (seconds since January 1st, 1970, Midnight GMT) |
|
Day of week (from |
|
Week number (according to ISO 8601, from |
|
Year (two digits) |
|
Year (four digits) |
|
Day of year (from |
|
Time zone difference to UTC (in seconds) |
Almost all of the formatting symbols shown in above table are available since PHP 3. There are only two exceptions: Using W
for determining the week number of a date was added in PHP 4.1.0, and using c
for retrieving the ISO 8601 representation for a date (for example, 2006-06-30T12:34:56+01:00) came in PHP 5.
The function date()
is very powerful and offers a broad range of ways to use it. However, especially if you have localized content, you need some good code. In this chapter, you will find many of them.
PHP's date and time functions have their own section in the PHP manual. You can find more information about date()
and friends at http://php.net/datetime
.