Time () is a number in PHP. This number indicates how many seconds have elapsed since. It's strange.
However, this facilitates computing,
Find that the previous day is time ()-60*60*24;
Find that the time of the previous year is time () * 60*60*24*365.
So how can we replace this number with the date format? We need to use the date function.
$ T = time ();
Echo date ("Y-m-d H: I: s", $ t );
The format of the first parameter is as follows:
A-"am" or "pm"
A-"AM" or "PM"
D-a few days, two digits. If there are less than two digits, fill in the first zero. For example, "01" to "31"
D-the day of the week, with three English letters, for example, "Fri"
F-month, full English name; for example: "January"
H-12 hours, for example, "01" to "12"
H-24 hours, for example, "00" to "23"
Hours in the g-12 hour format. Less than two hours do not fill in zero. For example: "1" to 12"
Hours in the G-24-hour format. Less than two hours do not fill in zero. For example: "0" to "23"
I-minutes; for example: "00" to "59"
J-a few days, two digits. If less than two digits are left blank, for example, "1" to "31"
L-the day of the week, full name in English; for example: "Friday"
M-month, two digits. If there are less than two digits, add zero in front, for example, "01" to "12"
N-month, two digits. If less than two digits are left blank, for example, "1" to "12"
M-month, with three English letters, for example, "Jan"
S-seconds; for example: "00" to "59"
The end of the S-character is followed by an English sequence, with two English letters, for example, "th", "nd"
T-specifies the number of days in a month, for example, "28" to "31"
U-total seconds
W-number of weeks, for example, "0" (Sunday) to "6" (Saturday)
Y-year, four digits, such as: "1999"
Y-year, two digits, for example, "99"
Z-the day of the year, for example, "0" to "365"
Other characters not in the upper column are listed directly.