Hi all. I'm relatively new when it comes to Java programming and this will be my first post. I'd like to compare dates by having the user input a specific date and check whether that date is greater than today's date by 7 days. If so, it will then link them to a different screen from the JSP.
I'm getting the current date from a class called "CurrentDateTime".
The method "getDate(String dateFormat)" looks like this:
That getDate() method is not relevant for the task you want to perform. There's no point in having the current date in String format, since you won't be manipulating or comparing it in that format. You'll be doing all that using Date, Calendar, and long.
I agree with Jeff, except there's no reason to reference GregorianCalendar in your code. Calendar.getInstance() will get you an instance of your locale's calendar (probably a GregorianCalendar), but the java.util.Calendar class has all the methods you need, and you'll be programming to the superclass (as opposed to locking in to a specific subclass). Also, there's no need to go through the long to set the time; simply calling setTime and passing in the date will do it nicely.
Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.