1. Date
string Date string $format $timestamp ] )
echo Date (' Y '). ' <br/> ';//2016
echo date (' Y '). ' <br/> ';//16
Echo '------<br/> ';
echo date (' m '). ' <br/> ';//03
echo Date (' M '). ' <br/> ';//Mar, Capital M denotes 3 abbreviated characters of the month
echo Date (' n '). ' <br/> ';//3,
echo Date (' F '). ' <br/> ';//March, full written in English month
Echo '------<br/> ';
echo Date (' d '). ' <br/> ';//09
echo Date (' J '). ' <br/> ';//9
echo Date (' S '). ' <br/> ';//th, which represents the suffix of the date.
Echo '------<br/> ';
echo Date (' G '). ' <br/> ';//4, 12-hour system, front without 0
echo Date (' G '). ' <br/> ';//16, 24-hour with leading 0
echo Date (' H '). ' <br/> ';//16, 24-hour system, front without 0
echo Date (' H '). ' <br/> ';//01, 12-hour with leading 0
Echo '------<br/> ';
echo Date (' I '). ' <br/> ';//42, Min
Echo '------<br/> ';
echo Date (' s '). ' <br/> ';//26, Sec
echo Date (' S '). ' <br/> ';//th, which represents the suffix of the date.
Echo '------<br/> ';
echo Date (' a '). ' <br/> ';//PM, lowercase am (a.m.) PM (PM)
echo Date (' A '). ' <br/> ';//PM, uppercase
Echo '------<br/> ';
echo Date (' L '). ' <br/> ';//Thursday, day of the week is written in English full (Tuesday)
echo Date (' L '). ' <br/> ';//1, Leap year returns 1 otherwise 0
echo Date (' D '). ' <br/> ';//Thu, which represents the 3-character abbreviation for the Day of the Week (Tue)
2, Mktime ()
?? Mktime generates a timestamp for the specified time, prototype:
int mktime ([int $hour = Date ("H") [, int $minute = Date ("i") [, int $second = Date ("s") [, int $month = Date ("n") [, int $day = Date ("J") [, int $year = Date ("Y") [, int $is _dst =-1]] []])
?
$tomorrow = Mktime (0,0,0,date ("M"), Date ("D") +1,date ("Y"));
echo "Tomorrow is". Date ("y/m/d", $tomorrow);
3, Strtotime ()
$d =strtotime ("10:38pm April 15 2015");
echo "Creation date is". Date ("Y-m-d H:i:sa", $d);
$d =strtotime ("Tomorrow");
echo Date ("Y-m-d H:i:sa", $d). "<br>";
$d =strtotime ("Next Saturday");
echo Date ("Y-m-d H:i:sa", $d). "<br>";
$d =strtotime ("+3 Months");
echo Date ("Y-m-d H:i:sa", $d). "<br>";
?
PHP Date and time