The document describes various format characters that are recognized for formatting dates and times, including characters to represent days, months, years, hours, minutes, seconds, timezones, and other date/time elements. Each character is listed along with a description of what element it represents and examples of possible returned values. These format characters can be used in the format parameter string to customize the output formatting of dates and times.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
33 views2 pages
Date Characters
The document describes various format characters that are recognized for formatting dates and times, including characters to represent days, months, years, hours, minutes, seconds, timezones, and other date/time elements. Each character is listed along with a description of what element it represents and examples of possible returned values. These format characters can be used in the format parameter string to customize the output formatting of dates and times.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2
The following characters are recognized in the format parameter string
format character Description Example returned values
Day --- ---
d Day of the month, 2 digits with leading zeros 01 to 31 A textual representation of a day, three D Mon through Sun letters j Day of the month without leading zeros 1 to 31 l (lowercase A full textual representation of the day of the Sunday through Saturday 'L') week ISO-8601 numeric representation of the day 1 (for Monday) through 7 N of the week (added in PHP 5.1.0) (for Sunday) English ordinal suffix for the day of the st, nd, rd or th. Works well S month, 2 characters with j Numeric representation of the day of the 0 (for Sunday) through 6 w week (for Saturday) z The day of the year (starting from 0) 0 through 365 Week --- --- ISO-8601 week number of year, weeks Example: 42 (the 42nd W starting on Monday (added in PHP 4.1.0) week in the year) Month --- --- A full textual representation of a month, such F January through December as January or March Numeric representation of a month, with m 01 through 12 leading zeros A short textual representation of a month, M Jan through Dec three letters Numeric representation of a month, without n 1 through 12 leading zeros t Number of days in the given month 28 through 31 Year --- --- 1 if it is a leap year, 0 L Whether it's a leap year otherwise. ISO-8601 year number. This has the same value as Y, except that if the ISO week o number (W) belongs to the previous or next Examples: 1999 or 2003 year, that year is used instead. (added in PHP 5.1.0) A full numeric representation of a year, 4 Y Examples: 1999 or 2003 digits The following characters are recognized in the format parameter string format character Description Example returned values
y A two digit representation of a year Examples: 99 or 03
Time --- --- a Lowercase Ante meridiem and Post meridiem am or pm A Uppercase Ante meridiem and Post meridiem AM or PM B Swatch Internet time 000 through 999 12-hour format of an hour without leading g 1 through 12 zeros 24-hour format of an hour without leading G 0 through 23 zeros h 12-hour format of an hour with leading zeros 01 through 12 H 24-hour format of an hour with leading zeros 00 through 23 i Minutes with leading zeros 00 to 59 s Seconds, with leading zeros 00 through 59 u Milliseconds (added in PHP 5.2.2) Example: 54321 Timezone --- --- Examples: UTC, GMT, e Timezone identifier (added in PHP 5.1.0) Atlantic/Azores Whether or not the date is in daylight saving 1 if Daylight Saving Time, 0 I (capital i) time otherwise. O Difference to Greenwich time (GMT) in hours Example: +0200 Difference to Greenwich time (GMT) with P colon between hours and minutes (added in Example: +02:00 PHP 5.1.3) T Timezone abbreviation Examples: EST, MDT ... Timezone offset in seconds. The offset for Z timezones west of UTC is always negative, -43200 through 50400 and for those east of UTC is always positive. Full --- --- Date/Time 2004-02- c ISO 8601 date (added in PHP 5) 12T15:19:21+00:00 Example: Thu, 21 Dec 2000 r » RFC 2822 formatted date 16:01:07 +0200 Seconds since the Unix Epoch (January 1 U See also time() 1970 00:00:00 GMT)