如何使用java代码在下拉列表中验证开始时间和结束时间? [英] How can I validate start time and end time in the dropdownlist using java code?

查看:107
本文介绍了如何使用java代码在下拉列表中验证开始时间和结束时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个下拉列表,两个都有30分钟的间隔,例如:9:00AM,9:30AM ...等到下午5:30我怎样才能通过以下条件验证这个...





1)时间必须小于时间。(时间格式为12小时,AM和PM)

2)如果一个节目安排在上午10:00到11:00,然后另一个节目不能安排在同一天上午10:30到11:30



< b>我尝试了什么:



我只尝试了二十四小时的格式。但我不知道上面提供的条件... plz为我提供了正确的解决方案...

解决方案

你应该使用日期(Java平台SE 7) [ ^ ]对象,它提供了比较不同值的方法。

I have two dropdown list, both are filled with 30mins intervals eg:9:00AM ,9:30AM...etc to 5:30PM how can i validate this with the following condition...


1)From time must be less than To time.(time format 12hrs with AM & PM)
2)If a program is scheduled for 10:00AM to 11:00AM, then another program can't be scheduled for 10:30AM to 11:30AM for the same date

What I have tried:

I tried only for twenty four hours format. but i don't have any idea for above provided condition...plz provide me the correct solution...

解决方案

You should use a Date (Java Platform SE 7 )[^] object, which provides methods for comparing different values.


这篇关于如何使用java代码在下拉列表中验证开始时间和结束时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆