AFAIK the only way is calculating it yourself
public static int calendarWeekIso(final Date inputDate) {
int thursdayDay = 4 + firstDayOfWeek;
Date thisThursday = new Date(inputDate.getYear(),
inputDate.getMonth(),
inputDate.getDate() - weekday(inputDate) +
thursdayDay);
Date firstThursdayOfYear = new Date(thisThursday.getYear(), 0,
1);
while (weekday(firstThursdayOfYear) != thursdayDay) {
firstThursdayOfYear.setDate(firstThursdayOfYear.getDate() + 1);
}
Date firstMondayOfYear = new
Date(firstThursdayOfYear.getYear(), 0,
firstThursdayOfYear.getDate() - 3);
Long cw = (thisThursday.getTime() - firstMondayOfYear.getTime())
/ ONE_DAY / DAYS_IN_A_WEEK + 1;
return cw.intValue();
}
On 5 ago, 17:15, Glimpse <[email protected]> wrote:
> Hello all,
>
> I'd like to know if there is an easy way to get the week number from a
> Date object. In pure Java, the Calendar class does the trick via a
> call to get(Calendar.WEEK_OF_YEAR); but the Calendar class is not
> available in GWT.
>
> Any idea?
--
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.