mktime() 函数对于日期运算和验证非常有用。它可以自动校正越界的输入:
// 语法:mktime(hour,minute,second,month,day,year)
echo(date('Y-m-d', mktime(0,0,0, 12, 36, 2001)));
echo(date('Y-m-d', mktime(0,0,0, 14, 1, 2001)));
echo(date('Y-m-d', mktime(0,0,0, 1, 1, 2001)));
echo(date('Y-m-d', mktime(0,0,0, 1, 1, 99)));
/**
2002-01-05 (36=31+5)
2002-02-01 (14=12+2)
2001-01-01
1999-01-01
**/