使用Date类进行日期格式化. 1 输入“yyyy-MM-dd hh:mm:ss”格式的String字符串,返回字符串 做一个简单判定,在当日显示为几点几分,同年为月日,不同年显示年月 function dateFormat(str){ //str格式为yyyy-mm-dd hh:mm:ss var nowDate=new Date(); var date; //由于各浏览器日期在获取时有差异,使用getfullXxx()进行对比 var strDate=new Date(str.replace