• Post Reply Bookmark Topic Watch Topic
  • New Topic

How do you validate Dates between 2 dates  RSS feed

 
bob morkos
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
IHow do you validate that date1 > date2 in Java. How do you check for this and for other date validation stuffs. Any help would be really aprreciated.
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at the compareTo() method in Date. Good for making simple comparisons. For some other date validation (e.g. "is it a weekday?") you may want to use a GregorianCalendar, which has many different methods, depending what you need.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!