Babajide Prince Babajide Prince - 1 month ago 34
Java Question

GWT Date equivalent to java.util.Calendar

I want to get the date of a particular day of the week e.g Wednessday. i.e If today's date is 27th Friday, Wednessday would infact be the 25th .

I could achieve this by

Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.DAY_OF_WEEK, Calendar.WEDNESDAY);
String thisWed = String.format("%tF%n", calendar)


The challenge here is that
java.util.Calendar
is not supported in GWT client side, Is there a possible solution without having to move this code to server side ?

Thanks

Answer

com.google.gwt.user.datepicker.client.CalendarUtil is what you are looking for, I guess;