Yes! That did it.
I wonder why it didnt roll properly over day?????
>>> [EMAIL PROTECTED] 2001-12-06 20:01:23 >>>
Maybe try something like this:
while (MyDate.get(Calendar.WEEK_OF_YEAR) <= MaxWeek) {
//set to Monday
MyDate.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
//make DateStringStart
//set to Friday
MyDate.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY);
//make DateStringEnd
//output <OPTION> tag
//set to next week
MyDate.roll(Calendar.WEEK_OF_YEAR, 1);
}
--- Magnus Jansson <[EMAIL PROTECTED]> wrote:
> Hi!
>
> When I use the GregorianCalendar and do a roll it doesnt switch
> month.
>
> What I want to do is to have a selectbox and see all weeknumbers in
> selected year and after the weeknumber write the date of monday and
> friday in the week. But with this code below I only get the same
> dates all the time and it is for Januari.
>
> Is this a normal behaviour for the GregorianCalendar object?????????
>
> <%
> int i, ThisWeek = MyDate.get(GregorianCalendar.WEEK_OF_YEAR);
> int MaxWeek = MyDate.getMaximum(GregorianCalendar.WEEK_OF_YEAR);
> int SelectedYear = MyDate.get(GregorianCalendar.YEAR);
> MyDate.set(SelectedYear, 0, 1);
> if (MyDate.get(GregorianCalendar.DAY_OF_WEEK) > 2)
> {
> for (i = MyDate.get(GregorianCalendar.DAY_OF_WEEK); i > 2; i--)
> {
> MyDate.roll(Calendar.DATE, false);
> }
> }
> String DateStringStart = "";
> String DateStringEnd = "";
> for (i = 1; i <= MaxWeek; i++)
> {
> DateStringStart = MyDate.get(Calendar.YEAR) + "-" +
> MyDate.get(Calendar.MONTH) + "-" + MyDate.get(Calendar.DATE);
> while (MyDate.get(Calendar.DAY_OF_WEEK) != 6)
> {
> MyDate.roll(GregorianCalendar.DATE, true);
> };
> DateStringEnd = MyDate.get(Calendar.YEAR) + "-" +
> MyDate.get(Calendar.MONTH) + "-" + MyDate.get(Calendar.DATE);
> if (i != ThisWeek)
> out.print("<option value='" + i + "'>Vecka: " + i + " Datumintervall:
> " + DateStringStart + " - " + DateStringEnd + "</option>");
> else
> out.print("<option value='" + i + "' selected>Vecka: " + i + "
> Datumintervall: " + DateStringStart + " - " + DateStringEnd +
> "</option>");
> while (MyDate.get(Calendar.DAY_OF_WEEK) != 2)
> {
> MyDate.roll(Calendar.DATE, true);
> };
> };
>
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> - - - - - - - - - -
> Magnus Jansson
> IT-Manager
> V�dd� folkh�gskola
> 760 40 V�dd�
> Sweden
>
> Phone: +46 (0) 176-528 00
> Cellular: +46 (0) 70-370 33 16
> Fax: +46 (0) 176-528 28
> http://www.vaddo.fhsk.se (work)
> http://www.jason.pp.se (private)
> ICQ: 52797837
>
>
> > --
> To unsubscribe: <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com
--
To unsubscribe: <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>
--
To unsubscribe: <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>