I need to get the day, month, year details from a Date value but getYear() is deprecated, gives year on 2 digits, and has problems with Y2K (2008 gives 108). The java doc recommends using java.util.calendar but it is not supported in GWT.
I want to avoid sending all the info back and forth between the server and client just to deal with dates.
Edit: Date handling functions should be implemented in GWT futur versions : http://code.google.com/p/google-web-toolkit/issues/detail?id=603Calendar might be supported
Do not use those deprecated methods on Date class in GWT.
If you don’t want to use third party Date implementations for GWT, You use a combination of
DateTimeFormatalong with string manipulation as a workaround for the time being, until GWT comes up with some better support for manipulating dates.Edit-
Similarly, avoid using new Date( yy, mm, dd ) has come inconsistencies depending on the browser and date range.
I have use a simple DateUtil Class to create and parse Date objects in GWT, maybe of some use to you –
(Warning: Very crude, and work in progress)