//字符串转时间
function getDate(strDate) {
var st = strDate;
var a = st.split(" ");
var b = a[0].split("-");
var c = a[1].split(":");
var date = new Date(b[0], b[1], b[2], c[0], c[1], c[2]);
return date;
}
//获得日期相差天数
Date.prototype.diff = function(date){
return (this.getTime() - date.getTime())/(24 * 60 * 60 * 1000);
}
js:string转换日期,日期计算
最新推荐文章于 2022-10-19 20:42:47 发布