-8

I use CalenderUtil for this.i tried few times with my code.but it didn't work.starting date given by date chooser and after the addition of 30 days it need to be set ending date to the other date chooser.but doesn't work and please mention any event i need to prefer. ex: mouseclicked event

import com.google.gwt.user.datepicker.client.CalendarUtil;
import java.text.DateFormat;
import java.util.Date;

Date d;
d = startingdatebox.getDate();
CalendarUtil.addMonthsToDate(d, 1);
endingdatebox.setDate(d);
Raman Sahasi
  • 30,180
  • 9
  • 58
  • 71
  • 1
    what do you mean by `doesn't work` - what happens? – Scary Wombat Sep 13 '16 at 05:08
  • 1
    Welcome to Stack Overflow. Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. Please find instructions here: [Short, Self Contained, Correct (Compilable), Example](http://sscce.org/). Thanks. – Ole V.V. Sep 13 '16 at 05:53

2 Answers2

-2

Well try this.

Calendar cal = Calendar.getInstance(); 
cal.add(Calendar.MONTH, 1);
dghtr
  • 561
  • 3
  • 6
  • 20
-6

Without checking the API, perhaps that function doesn't update 'd' in place but returns a new date object. Try:

d = CalendarUtil.addMonthsToDate(d, 1);