> Hey guys, I just found out that the Java Calendar class isn't
> compatible with GWT (Assumed it was since Date was). I'm a Java newb
> and spent a few hours figuring out how to do what I wanted to do with
> the Calendar class, and I'm clueless how to do this with GWT, so any
> help would be appreciated.
java.util.Date is compatible with GWT. Probably your IDE will complain
about deprecated methods. But they are not for GWT. So you probably
will end up with a lots of '@SuppressWarnings("deprecation") // GWT
requires Date' before your method declaration.


> 1. Get today's date.
new Date();

> 2. Using the current date, get the date of the first day of the week
> (Sunday), and I think I might need to know how to get the end date
> also.
> 3. How to Add and subtract a number of days to a date.
Date date = new Date();
date.getDay() gives you the current day in the week.
date.getTime() gives you the time in milliseconds since 1/1/1970
date.setTime(date.getTime() - 24 * 60 * 60 * 1000) sets the date to
yesterday

> 4. I need to know how to parse all the above questions information
> into a string.
Take a look at this post: 
http://groups.google.com/group/google-web-toolkit/browse_thread/thread/641e83518db5ee0e

> Off the top of my head, that's what I'm trying to do. 1 More question:
> 5. Would it improve performance while handling a start date and an end
> date for an event, instead of keeping an end date, calculating the
> duration that the event would last, rather than calculating the date?
> Would it even be worth it? (A friend recommended this)
Computing the difference of two dates is straightforward
long millisDiff = end.getTime() - start.getTime();

> 6. Are we seeing any updates coming for working with dates? I'm
> currently using GWT 2.03.
No idea, but I will not depend on that.

To finish you can take a look in the package
com.google.gwt.user.datepicker.client
http://code.google.com/p/google-web-toolkit/source/browse/#svn/trunk/user/src/com/google/gwt/user/datepicker/client
to see how GWT guys seems to work with dates.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to