Ec (2); & nbsp; $ time2010-1-11; & nbsp; define a daytime environment and change it to 2010-01-1 & nbsp; $ splitDateexplode (& quot; -& quot;, $ time); & nbsp; split to & quot;-& quot; Separate & nbsp; $ stimemktime (0, script ec (2); script
$ Time = '2017-1-11 ';
// Define a daytime. I will change it to 2010-01-1 1-1.
$ SplitDate = explode ("-", $ time );
// Split "-"
$ Stime = mktime (0, 0, 0, $ splitDate [1], $ splitDate [2], $ splitDate [0]);
// Use mktime to convert it to time Load
If (intval ($ splitDate [1]) <10 & substr ($ splitDate [1], 0, 1 )! = '0 ')
{
$ SplitDate [1] = '0'. $ splitDate [1];
}
// Obtain a number for the month to determine if the format is 01. Otherwise, add 0.
If (intval ($ splitDate [2]) <10 & substr ($ splitDate [2], 0, 1 )! = '0 ')
{
$ SplitDate [2] = '0'. $ splitDate [2];
}
// Perform the same operation on the date. If it is less than 10, add 0.
/*
Function Analysis:
Explode uses one string to separate another string array explode (string separator, string [, int limit])
The mktime function returns the Unix timestamp of a date. Mktime (hour, minute, second, month, day, year, is_dst)
Intval int intval (mixed var [, int base])
Return the integer value of the variable var by using a specific hexadecimal conversion (decimal by default.
The substr function returns a part of the string substr (string, start, length)
*/
?>
Original tutorial on this site, reposted with reference to www.111cn.net