SoFunction
Updated on 2025-04-06

Subtraction processing implementation code of JS date object


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

var t1=new Date((/-/g, '/'));
var t2=new Date((/-/g, '/'));

alert((t2-t1).toString()=="3600000"?"yes":"no");