支票日期从今天起大于30天 [英] Check Date greater than 30 days from today's date
问题描述
我正在使用jQuery datepicker并试图找出今天日期和选定日期之间的差异,但是却遇到了问题……而不是问题……我无法完美地找到它……
I am using jQuery datepicker and tried to find out difference between todays date and selected date , but getting issues... rather than issues... I was not able to find it perfectly...
我试图在日期选择器的onSelect事件"上执行此操作
I tried to do this on 'onSelect event of datepicker '
问题: 如何检查使用jQuery Datepicjer选择的日期是否从今天起大于30天?
Question: How to check whether selected Date using jQuery Datepicjer is greater than 30 days from todays date ?
任何帮助将不胜感激.... !! 注意:不想使用任何库,我只需要使用jQuery即可解决.
Any help will be appreciated....!! note: dont want to use any libraries, I need to solve this by using only jQuery.
推荐答案
从现在开始获取30天的时间戳:
Get the timestamp for 30 days from now:
var timestamp = new Date().getTime() + (30 * 24 * 60 * 60 * 1000)
// day hour min sec msec
将该时间戳与所选日期的时间戳进行比较.
Compare that timestamp with the timestamp for the selected date.
if (timestamp > selectedTimestamp) {
// The selected time is less than 30 days from now
}
else if (timestamp < selectedTimestamp) {
// The selected time is more than 30 days from now
}
else {
// -Exact- same timestamps.
}
这篇关于支票日期从今天起大于30天的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!