PHP日期和时间 1.验证日期。 checkdate()如果提供的日期有效,返回TRUE,否则返回FALSE。 bool bheckdate(int month,int day,int year); 2.格式化日期。 date()函数返回根据预定义的格式制定的指令格式化的时间和日期的字符串形式。 string date(string format [,int timestamp]); date("F d, Y"); August 22,2007 date("l"); Monday date("m-d-Y"); 07-15-2010 3.了解当前时间的更多信息。(???) gettimeofday()函数返回与当前时间有关的元素所组成的一个关联数组。 mixed gettimeofday([bool return_float); 返回 Array([sec],[usec],[minuteswest],[dsttime]) 4.将时间戳转换为用户友好的值。 array getdate([int timestamp]); 返回 Array([hours],[mday],[minutes],[mon],[month],[seconds],[wday],[weekday],[wday],[weekday],[yday],[year],[0]); 5.确定当前的时间戳。 int time(); 6.根据特定日期和时间创建时间戳。 int mktime([int hour [,int minute [,int second [,int month [,int day [,int year [,int is_dst]]]]]]]); 日期函数。 显示本地化的日期和时间。 7.设置默认的本地化环境。(???) string setlocale(mixed category,string locale [,string locale...]); string setlocale(mixed category,array locale); 8.strftime()函数根据setlocale()制定的本地化设置来格式化日期和时间。 string strftime(string format [,int timestamp]); 9.显示网页的最新修改日期。 int getlastmod(); 10.确定当前月份中的天数。 使用date()的t参数。 date("t"); 11.确定给定月份中的天数。 mktime()与date()合作。 $lastday = mktime(0,0,0,3,0,2007); echo date("t",$lastday); 12.计算当前日期后(前)x天的日期。 strtotime()函数和GNU日期语法(???),加负号表示前x天。 $futuredate = dtrtotime("45 days"); echo date("F d, Y",$futuredate);