本文介绍了检查两个日期时间之间是否存在时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的代码是
my code is
var curentDate = new Date().toLocaleString();
var fromdate = document.getElementById("hdnfromdate").value;
var todate = document.getElementById("hdntodate").value;
var date = new Date(fromdate);
var offset = date.getTimezoneOffset();
var finalFrom = date.getTime() + (-offset) * 60 * 1000;
var finalFromDate = new Date(finalFrom).toLocaleString();
var todate = new Date(todate);
var offset = todate.getTimezoneOffset();
var finalTo = todate.getTime() + (-offset) * 60 * 1000;
var finalFromTo = new Date(finalTo).toLocaleString();
i想检查currentDate是否在finalFromDate和finalToDate之间如何查看
plz help。 ..
i want check if currentDate is between finalFromDate and finalToDate how to check it
plz help...
推荐答案
if(currentDate > finalFromDate && currentDate < finalToDate )
{
alert("currentDate is between finalFromDate and finalToDate ");
}
这篇关于检查两个日期时间之间是否存在时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!