分类分类
2015-04-21 15:33作者:zhao
本文实例讲述了javascript格式化指定日期对象的方法。分享给大家供大家参考。具体如下:
/*
* 格式化Date对象为:“2015-04-17 10:20:00”
* var dateObj = new Date();
*/
function formartDate(dateObj){
var updatetimeval =dateObj.getFullYear()+"-"+(dateObj.getMonth()+1)+"-" +dateObj.getDate()
+" "+dateObj.getHours()+":"+dateObj.getMinutes()+":"+dateObj.getSeconds();
return updatetimeval;
}
相关