ITeye博客

js判断时间差

chiangfai · 2015-09-10 17:37 · js · web front end · Web前端 · JS · Markdown

//var startDate = "2015-09-09";
//var endDate = "2015-09-08";
var startDate = "2015-09-09 15:09:04";
var endDate   = "2015-09-09 15:09:05";
alert(new Date(startDate.replace(/\-/g, '\/')) - new Date(endDate.replace(/\-/g, '\/')));//以毫秒为单位,返回startDate与endDate时间差

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。