Hi all, how do I add dates in Java ? I guess I could do it via a GregorianCalendar object, but all I have is a java.util.date. I dont know how to turn it into a GregorianCalendar. Can anyone help me ? either by turning a java.util.date into a Calendar object or by adding / subtracting days to a java.util.date thx in advance
If you run that program, you should get April 13, 2003 and whatever the current time is as output. If you start with a Date object you can use the method Calendar.setTime(Date) method to set the Calendar object to the date represented by the Date object. I hope this helps. Chris
Giselle: create an caledar object Calendar.getInstance(), and call its setTime(date) method, then calculate it however you want. That should resolve your problem.