By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,740 Members | 790 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,740 IT Pros & Developers. It's quick & easy.

check for a valid date

P: 50
I have another problem concerning to check if a particular date belongs in a particular range. For example I need to check whether 16th december lies between 10th December and 20th December. I have a startdate and an endDate of type Date. The Date startDate and Date endDate attributes are the ranges for a Date input. I need to check whether the attribute input lies between startDate and endDate.

Can please some1 tell me how can i implement this?

Thanks.
Dec 16 '07 #1
Share this Question
Share on Google+
4 Replies


sicarie
Expert Mod 2.5K+
P: 4,677
Did you check out the Date class documentation? There are two boolean isBefore() and isAfter() methods, or the compareTo() method, or.... well, take a look!
Dec 16 '07 #2

P: 50
Did you check out the Date class documentation? There are two boolean isBefore() and isAfter() methods, or the compareTo() method, or.... well, take a look!
ok thanks! i ve arranged it!!:)
Dec 16 '07 #3

sicarie
Expert Mod 2.5K+
P: 4,677
Great! Just as an FYI - if you are using a class like that, if you Google "Java date class" (or whatever class you are using) you will usually return the Javadoc within the first two or three returns - those are a great resource to be able to use and search on your own.

But, as always, if you get stuck on something please feel free to post again.
Dec 16 '07 #4

P: 50
To tell you the truth , i searched through the API, but it didnt come into my mind to use the before()and after(). Well thanks again for your help!! :)
Dec 16 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.