Play PHP (ii)--php powerful time function: Date ()
PHP has a relatively powerful time function date (), which has the following series of parameters:
For example:
echo Date ("y-m-d h:i:s");
If the time is wrong, modify the php.ini to the;d ate.timezone, delete the preceding semicolon, and change to date timezone = PRC. Save, restart the APAHCE service to
The red part is for some common
Years:
Y 2 digits indicate the year for example: 99 or 03
Y 4-digit year full representation for example: 1999 or 2003
L is a leap year if the leap year is 1, otherwise 0
Month:
n number of months, without leading 1 to 12
The month represented by the m number, with a leading 1 to 12
M three-letter abbreviation for month Jan to Dec
F month, full text format, such as January or March January to December
t the number of days that a given month should be 28 to 31
Day:
Day of the J month, without leading 1 to 31
Day of the D month, 2 digits with leading zeros 01 to 31
Days 0 to 366 in the Z-year
Week:
The day of the D-week, the text says, 3 letters Mon to Sun
L (Lowercase letter of "L") Day of the week, full text format Sunday to Saturday
The day of the W week, the number represents 0 (Sunday) to 6 (Saturday)
N ISO-8601 format number represents the day of the week (PHP 5.1.0 new Plus) 1 (Monday) to 7 (Sunday)
The week of the year in W ISO-8601 format, starting from Monday (PHP 4.1.0 New) 42 (42nd Week of the year)
When
G-hour, 12-hour format, without leading 1 to 12
G-hour, 24-hour format, without leading 00 to 23
H-hour, 12-hour format, with leading 1 to 12
H-hour, 24-hour format, with leading 000 to 23
Score of
I have a leading zero minute number 00 to 59>
Seconds:
S number of seconds, with leading 000 to 59>
Morning/Afternoon:
A lowercase morning and afternoon value am or PM
A uppercase morning and afternoon value am or PM
Other:
B Swatch Internet Standard 000 to 999
Date in C ISO 8601 format (PHP 5 new Plus) 2004-02-12t15:19:21+00:00
E Time zone identifier (PHP 5.1.0 new) Example: Utc,gmt,atlantic/azores
I is daylight saving time if daylight saving time is 1, otherwise 0
o ISO-8601 format year number.
O hours of difference from GMT for example: +0200
The difference between P and GMT (GMT) is separated by a colon between hours and minutes for example: +02:00
R RFC 822 Format date For example: Thu, 2000 16:01:07 +0200
S English suffix, 2 characters st,nd,rd or th, after the number of days per month. Can be used with J.
T the time zone where the machine is located
The number of seconds since the beginning of the Unix era (January 1 1970 00:00:00 GMT) time () get timestamp
The number of seconds to offset the Z-time difference. The time zone offset in the west of UTC is always negative, and the east of UTC is positive. 43200 to 43200