• Post Reply Bookmark Topic Watch Topic
  • New Topic

Checking Date  RSS feed

 
Vijay Chandran
Ranch Hand
Posts: 186
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear friends,

How to compare two dates?

My problem is, i am having a date in this format: ddmmyyyy (12102007).
I want to check whether this date is a future date or not. How can i do this?

Kindly provide your help.

Regards,
Vijay
 
Freddy Wong
Ranch Hand
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can parse the String using SimpleDateFormat into Date. Since Date implements Comparable, you can use compareTo() to determine whether it's a future date or not.

Check the API for more information on how to use those classes.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!