PHP (2) -- Powerful PHP time function: date () PHP has a relatively powerful time function date (). This method has the following parameters: echodate (& quot; Y-m-dH: I: s & quot;); 2015-01-0913: 03: 30 if the time is incorrect, modify php. ini, to the; date. timezone: delete the semicolon and change it to dat to PHP (2) -- Powerful time function of PHP: date ()
PHP has a relatively powerful time function date (). This method has the following parameters:
For example:
echo date("Y-m-d H:i:s"); //2015-01-09 13:03:30
If the time is incorrect, modify php. ini to date. timezone, delete the semicolon, and change it to date timezone = PRC. Save and restart the Apahce service.
The red part is commonly used
Year:
The year represented by y two digits, for example, 99 or 03.
The year in which the four digits of Y are complete, for example, 1999 or 2003.
L whether it is a leap year. if it is a leap year, it is 1; otherwise, it is 0.
Month:
N indicates the month with no leading zeros 1 to 12.
The month represented by m numbers, with a leading zero from 01 to 12
M: The month Jan to Dec.
F month, complete text format, such as January or March January to December
T the number of days in a given month from 28 to 31
:
The day of month j, with no leading zeros 1 to 31
D. The day of the month, which has two numbers from the leading zero, 01 to 31.
Day 0 to 366 in year z
Week:
D. The day of the week. The text indicates the three letters Mon to Sun.
L ("L" lowercase letter) day of the week, complete text format Sunday to Saturday
The day of the week. The number indicates 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 every week (new in PHP 4.1.0) 42 (42nd weeks of the year)
Hour:
G-hour, 12-hour format, no leading zero 1 to 12
G-hour, in 24-hour format, no leading 0 to 23
H-hour, 12-hour format, with a leading value of 0 to 12
H-Hour, in 24-hour format, with a leading zero 00 to 23
Points:
I have the number of minutes leading to zero from 00 to 59>
Seconds:
S seconds, with a leading zero 00 to 59>
Morning/afternoon:
A lower-case morning and afternoon values: am or pm
A capital value of AM and PM
Others:
B Swatch Internet standard: 000 to 999
Date in c ISO 8601 format (new PHP 5): 19: 21 + 00: 00
E time zone identifier (new in PHP 5.1.0) for example: UTC, GMT, Atlanta/Azores
When I is running or not, if it is running, it is 1; otherwise, it is 0.
O ISO-8601 format year number.
O hours different from Greenwich Mean Time, for example: + 0200
The difference between P and Greenwich Mean Time (GMT). There are colons between hours and minutes, for example: +
Date in RFC 822 format: Thu, 21 Dec 2000 16:01:07 + 0200
The suffix of S after the number of days per month. it can contain 2 characters including st, nd, rd, and th. Can be used with j
T the time zone of the local machine
U obtains the timestamp from the Unix epoch (January 1 1970 00:00:00 GMT) to the current time ().
The number of seconds of the Z time difference offset. The time zone offset to the west of UTC is always negative, and the east of UTC is positive. -43200 to 43200