check for a valid date

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sugard
    New Member
    • Aug 2007
    • 50

    check for a valid date

    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.
  • sicarie
    Recognized Expert Specialist
    • Nov 2006
    • 4677

    #2
    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!

    Comment

    • sugard
      New Member
      • Aug 2007
      • 50

      #3
      Originally posted by sicarie
      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!!:)

      Comment

      • sicarie
        Recognized Expert Specialist
        • Nov 2006
        • 4677

        #4
        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.

        Comment

        • sugard
          New Member
          • Aug 2007
          • 50

          #5
          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!! :)

          Comment

          Working...