Copy Code code as follows:
echo "Today:". Date ("y-m-d"). " <br> ";
echo "Yesterday:". Date ("Y-m-d", Strtotime ("1 day"), "<br>";
echo "Tomorrow:". Date ("Y-m-d", Strtotime ("+1 Day"). " <br> ";
echo "A week later:". Date ("Y-m-d", Strtotime ("+1 Week")). " <br> ";
echo "2 days a week four hours two seconds later:". Date ("Y-m-d g:h:s", Strtotime ("+1 Week 2 days 4 hours 2 Seconds")). " <br> ";
echo "Next Monday Four:". Date ("Y-m-d", Strtotime ("next Thursday")). " <br> ";
echo "Last Monday:". Date ("Y-m-d", Strtotime ("Monday")). " <br> ";
echo "One months ago:". Date ("Y-m-d", Strtotime ("last month")). " <br> ";
echo "One months later:". Date ("Y-m-d", Strtotime ("+1 Month")). " <br> ";
echo "Ten years later:". Date ("Y-m-d", Strtotime ("+10 Year")). " <br> ";
The strtotime () function resolves a date-time description to a Unix timestamp
int Strtotime (string time [, int now])
PHP Week to get code:
Copy Code code as follows:
Date ("L");
Data will be available for English week like Sunday
Date ("W");
This can get a digital week like 123, note 0 is Sunday
Get Chinese week can be like this
Copy Code code as follows:
$weekarray =array ("Day", "one", "two", "three", "four", "five", "six");
echo "Week". $weekarray [Date ("W")];
Get the specified date is:
[Code]
$weekarray =array ("Day", "one", "two", "three", "four", "five", "six");
echo "Week". $weekarray [Date ("W", "2011-11-11")];
Because the date function is very powerful, he is perfectly capable of doing all this work. I have a table in the manual.
A-"AM" or "PM"
A-"AM" or "PM"
D-days, two digits, if less than two digits in front of 0, such as: "01" to "the"
D-Day of the week, three English letters; for example: "Fri"
F-month, full name in English; such as: "January"
h-12 hours, such as: "01" to ""
H-24 hours of the hour, such as: "00" to "" "
g-12 hours, less than two digits do not fill 0; For example:" 1 "to" G-24 hours of the hour, less than two to fill 0; such as: "0" to "a"
I-min; such as: "00" to "two"
J-days, two digits, if less than digits do not fill 0, such as: "1" to ""
L-Day of the week, the full name of the English language, such as: "Friday"
M-month, Two digits, if less than two in front of the 0; such as: "01" to "the"
N-month, two digits, if less than two digits, do not make up 0, such as: "1" to "a"
M-month, three English letters, such as: "The" "" "" ","
S-second, such as: "00" to ""
S-word Sukayin Text 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-Number of days of the week, such as:" 0 "(Sunday) to" 6 "(Saturday)
Y-year, four digits; for example:" 1999 "
Y-year, two digits; such as: "" "
Z-the first day of the year; For example:" 0 "to" 365 "