Grammar
Date (format,timestamp) parameter description
Format required. Specifies the format of the timestamp.
Timestamp is optional. Time stamp is specified. The default is the current date and time
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 do you change this number to a date format, using the date () function?
$t =time (); www.3ppt.com
echo Date ("Y-m-d h:i:s", $t);
The format of each parameter is represented by:
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 "31"
D-Days of the week, three English letters; such as: "Fri"
F-month, full name in English; such as: "January"
H-12 hours of the hour; such as: "01" to "12"
H-24 hours of the hour; such as: "00" to "23"
G-12 hours of the hour, less than two digits do not fill 0; such as: "1" to 12 "
G-24 hours of the hour, less than two digits do not fill 0; such as: "0" to "23"
I-minute; such as: "00" to "59"
J-A few days, two digits, if less than two bits do not fill 0; such as: "1" to "31"
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 "12"
N-month, two digits, if less than two digits does not fill 0; such as: "1" to "12"
M-month, three letters of English; such as: "Jan"
S-second; such as: "00" to "59"
S-End with English ordinal number, two English letters; such as: "th", "nd"
T-the number of days in the specified month; such as: "28" to "31"
U-Total number of seconds
W-Number of days of the week, such as: "0" (Sunday) to "6" (Saturday)
Y-year, four digits; such as: "1999"
Y-year, two digits; such as: "99"
Z-the day ordinal of a year; such as: "0" to "365"
Other characters that are not listed directly list the character
PHP Date-formatted date
The first parameter of the date () function specifies how the date/time is formatted. It uses letters to represent the format of dates and times. Some of the available letters are listed here:
D-Day of the month (01-31)
M-Current month, measured in digital (01-12)
Y-Current year (four digits)
You can find all the letters you can use in the format parameters in our PHP date reference manual.
You can insert additional characters between letters, such as "/", ".", or "-" to add additional formatting:
Copy the Code code as follows:
echo Date ("y/m/d");
echo "
";
echo Date ("Y.M.D");
echo "
";
echo Date ("y-m-d");
?>
The above describes the use of TrueCrypt PHP in the use of the date time of day function of the method summary, including the use of TrueCrypt content, I hope the PHP tutorial interested in a friend helpful.