将日期的持续时间与选定的下拉值进行比较...请阅读

发布于 2024-08-23 19:41:08 字数 120 浏览 1 评论 0原文

我的下拉菜单的值为“一年”,“两年”,...等等。好吧?我还有两个带有日历扩展器的 ajax 文本框。如果下拉列表中选择的值为“一年”并且两个文本框值之间的持续时间意味着日期不匹配,我想弹出警报消息。明白我的意思了吗?请帮我。

I have the Drop down with values as "One year ", "Two year",...etc.. Ok? also i have two ajax textbox with calender extender . I want to popup alert message if dropdown selected value is "One year" and duration between the both textbox value Means dates not matches. getting what i mean ? please help me.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

生活了然无味 2024-08-30 19:41:08
Algorithm :
1.Get the both date from the text box.
2. The find the epcoch time for each date. //
3. subtract the both dates.
4. subtract_result = 365*24*60*60  // Finding the 1 year timestamp values
5. So, it the difference exceed than above calculation , you could sure that the date is mis matching.
 

// This is for first date first = new Date(2010, 03, 08, 15, 30, 10); // Get the first date epoch object // document.write((first.getTime())/1000); // get the actual epoch values second = new Date(2012, 03, 08, 15, 30, 10); // Get the first date epoch object //document.write((second.getTime())/1000); // get the actual epoch values diff= second - first ; one_day_epoch = 24*60*60 ; // calculating one epoch if ( diff/ one_day_epoch > 365 ) // check , is it exceei { alert( 'date is exceeding one year'); }

Algorithm :
1.Get the both date from the text box.
2. The find the epcoch time for each date. //
3. subtract the both dates.
4. subtract_result = 365*24*60*60  // Finding the 1 year timestamp values
5. So, it the difference exceed than above calculation , you could sure that the date is mis matching.
 

// This is for first date first = new Date(2010, 03, 08, 15, 30, 10); // Get the first date epoch object // document.write((first.getTime())/1000); // get the actual epoch values second = new Date(2012, 03, 08, 15, 30, 10); // Get the first date epoch object //document.write((second.getTime())/1000); // get the actual epoch values diff= second - first ; one_day_epoch = 24*60*60 ; // calculating one epoch if ( diff/ one_day_epoch > 365 ) // check , is it exceei { alert( 'date is exceeding one year'); }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文