PHP Time format Controller comparison table sharing _php tips

Source: Internet
Author: User
Tags comparison table iso 8601 iso 8601 format lowercase
format character Description return Value Example
Day --- ---
D The first day of the month with a leading zero of 2 digits 01 to 31
J Days of the month, no leading zeros 1 to 31
S English suffix after the number of days per month, 2 characters st,nd,rd or th. Can be used with J.
Z Day ordinal of the year 0 to 366
Week --- ---
L (Lowercase letter of "L") Day of the week, complete text format Sunday to Saturday
D Day of the week, text representation, 3 letters Mon to Sun
N ISO-8601 format number of days of the week (PHP 5.1.0 new addition) 1 (expression Monday) to 7 (expression Sunday)
W The day ordinal of the week, the number indicates 0 (expression Sunday) to 6 (expression Saturday)
W The first weeks of the ISO-8601 format year, starting from Monday (PHP 4.1.0 New) For example: 42 (42nd Week of the year)
Month --- ---
F month, complete text format, such as January or March January to December
M The month that the number represents, with a leading zero 01 to 12
M A three-letter-abbreviated month To Dec.
N The month that the number represents, without a leading zero 1 to 12
T The number of days that a given month should be 28 to 31
Years --- ---
L Whether it is a leap year If it is a leap year is 1, otherwise 0
O ISO-8601 format year number. This is the same value as Y, except if the ISO number of weeks (W) belongs to the previous year or the next year, then the year is used. (PHP 5.1.0 new addition) examples:1999 or 2003
Y Year with 4 digits full representation For example: 1999 or 2003
Y Year in 2-digit digits For example: 99 or 03
Time --- ---
A Lowercase morning and afternoon values AM or PM
A Uppercase morning and afternoon values AM or PM
B When Swatch Internet standards 000 to 999
G Hours, 12-hour format, no leading zeros 1 to 12
G Hours, 24-hour format, no leading zeros 0 to 23
H Hours, 12-hour format, with leading zeros 01 to 12
H Hours, 24-hour format, with leading zeros 00 to 23
I Number of minutes with leading zeros 00 to 59>
S Number of seconds with leading zeros 00 to 59>
Time --- ---
E Time zone identification (PHP 5.1.0 new addition) For example: Utc,gmt,atlantic/azores
I is Daylight saving time If daylight saving time is 1, or 0
O Hours of difference from GMT For example: +0200
P The difference between GMT (GMT) and the hours and minutes separated by a colon (PHP 5.1.3 new addition) For example: +02:00
T Time zone in which this machine resides For example: EST,MDT ("translator note" under Windows for full text format, such as "Eastern Standard Time", the Chinese version will display "China standard Times").
Z The number of seconds for the slack offset. The time zone offset to the west of UTC is always negative, and the time zone offset to the east of UTC is always positive. -43200 to 43200
Full Date/Time --- ---
C ISO 8601 Format Date (PHP 5 new addition) 2004-02-12t15:19:21+00:00
R RFC 822 date in format Example: Thu, DEC 2000 16:01:07 +0200
U Number of seconds since the Unix era (January 1 1970 00:00:00 GMT)-time stamp See Time ()

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.