Time () is a number in PHP that indicates how many seconds have gone from 1970-01-01 to now, it's weird.
But it's easy to calculate,
To find out the day before is time () -60*60*24;
To find out when the previous year was time () *60*60*24*365
So how to change this number into a date format, it's going to use the date function.
$t =time (); echo Date ("Y-m-d h:i:s", $t);
The format of the first parameter means:
A-"AM" or "PM"
A-"AM" or "PM"
D-a few days, two digits, if less than two is the front 0, such as: "01" to "seven"
D-Day of the week, three letters of English; such as: "Fri"
F-month, English full name, such as: "January"
h-12 hours of the hour, such as: "01" to "a"
H-24 hours of the hour, such as: "00" to ""
g-12-hour system Hours, less than two digits do not fill 0; such as: "1" to "
G-24 hours, less than two digits do not fill 0, such as:" 0 "to"
I-minute, such as: "00" to "the"
J-A few days, two digits, if less than two digits do not fill 0, such as: "1" to "31" Br>l-Day of the week, English full name; such as: "Friday"
M-month, two digits, if less than two digits in front of 0, such as: "01" to "Nine"
N-month, two digits, if less than two digits do not fill 0, such as: "1" to "seven"
M-month, three English letters, such as: "Ja N "
S-second;" 00 "to" a "
S-tail with English ordinal number, two English letters, such as:" th "," nd "
T-Specify the number of days of the month, such as:" 28 "to" + "
U-Total seconds
W-Digital type The day of the week, such as: "0" (Sunday) to "6" (Saturday)
Y-year, four digits, such as: "1999"
Y-year, two digits, such as: "" "
Z-Days of the year, such as:" 0 "to" 365 "
Other not listed above Character lists the character directly