php里日期格式化用到两个函数:
strotime --- 剖析任何英文的日期时间成为unix时间戳记
语法:int strotime(string time [, int now])
Example:
echo strtotime("2008-11-24 11:41:42");
echo strtotime("10 march 2000");
date --- 将本地的时间/日期格式化
语法:string date (string format [,int timestamp])
Example:
date("Y-m-d H:i:s",strtotime($row["validTime"]) //2007-01-18 15:27:31
date("Y/m/d H:i:s",strtotime($row["validTime"]) //2007/01/18 15:27:31
date("m月d日 H:i",strtotime("2008-11-24 11:41:42")) //11月24日 11:41