Home  >  Article  >  Web Front-end  >  JS date对象的减法处理实现代码_时间日期

JS date对象的减法处理实现代码_时间日期

WBOY
WBOYOriginal
2016-05-16 18:13:14794browse
复制代码 代码如下:

var time1="2010-11-01 10:12:12";
var time2="2010-11-01 11:12:12";

var t1=new Date(time1.replace(/-/g, '/'));
var t2=new Date(time2.replace(/-/g, '/'));

alert((t2-t1).toString()=="3600000"?"yes":"no");
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn