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

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

WBOY
Release: 2016-05-16 18:13:14
Original
862 people have browsed it
复制代码 代码如下:

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");
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template