On 24 août, 18:05, Paul Schwarz <[email protected]> wrote:
> String dayOfWeek = DateTimeFormat.getFormat("c").format(myDate);
> /*
>  * Assuming that 6=Sat and 0=Sun.
>  */
> if ("6".equals(dayOfWeek) || "0".equals(dayOfWeek)){
>     // it's the weekend, let's party!
>
> }
>
> Hi folks, I feel this code is not robust because I believe that
> different locales call Monday the first day of the week and others
> call Sunday the first day of the week. So our 6 and 0 might give us
> Sat and Sun, or Sun and Mon depending on locales.
>
> Can someone tell me a better way (in GWT) of knowing if it's the
> weekend.

What's wrong with myDate.getDay() ?
http://download.oracle.com/javase/6/docs/api/java/util/Date.html#getDay()

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

Reply via email to