Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to do calendar operations in Java GWT? How to add days to a Date?

Tags:

java

gwt

Since GWT does not provide the GregorianCalendar class, how to do calendar operations on the client?

I have a Date a and I want the Date, which is n days after a.

Examples:

a (2000-01-01) + n (1) -> 2000-01-02 a (2000-01-01) + n (31) -> 2000-02-01 
like image 759
Witek Avatar asked Mar 27 '10 01:03

Witek


1 Answers

Updated answer for GWT 2.1

final Date dueDate = new Date(); CalendarUtil.addDaysToDate(dueDate, 21); 

Edit: the fully qualified name of this class is com.google.gwt.user.datepicker.client.CalendarUtil.

like image 68
Tony BenBrahim Avatar answered Oct 18 '22 11:10

Tony BenBrahim