cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject RE: Working with Weeks (to be translated to DATE > ? AND DATE < ?) for use in query
Date Fri, 12 Mar 2004 09:00:41 GMT
Thx, i will experiment a little and let you know if I found a solution to my
problem !!

-----Original Message-----
From: John L. Webber []
Sent: 12mm2004 9:59
Subject: Re: Working with Weeks (to be translated to DATE > ? AND DATE <
?) for use in query

Hi Robby

This isn't really a Cocoon question, but: (caveat emptor - haven't tried 
out this code or thought deeply about it ;-))

(omitting necessary imports)
GregorianCalendar now = new GregorianCalendar();
int week = now.get(Calendar.WEEK_OF_YEAR);
int firstDay = now.getFirstDayOfWeek();

//The next line is overly simplistic and probably won't really work 
correctly. You need to compare this day with the actual day,
//and set the field accordingly
now.set(Calendar.DAY_OF_WEEK, firstDay);
int startDate = now.get(Calendar.DAY_OF_MONTH);
int startMonth = now.get(Calendar.MONTH); //0-based!
int startYear = now.get(Calendar.YEAR);

//Now calculate the last day of the week and proceed similarly...


John wrote:

>Suppose I want to offer three hyperlinks...
>*See all Problems last week
>*See all Problems this week
>*See all Problems next week
>For the middle link, I need to retreive the current weeknumber (e.g. week
>with its startdate (05-01-04) and enddate (11-01-04).  
>How would i do this in java ??
>Kind regards,
 Jentro Technologies GmbH
 John L. Webber, Software Development
 Rosenheimer Str. 145e	    81671 M√ľnchen
 Tel. +49 89 189 169 80 
 Fax  +49 89 189 169 99
NOTICE: The information contained in this e-mail is confidential or may
otherwise be legally privileged. It is intended for the named recipient
only. If you have received it in error, please notify us immediately by
reply or by calling the telephone number above and delete this message and
all its attachments without any use or further distribution of its contents.
Please note that any unauthorised review, copying, disclosing or otherwise
making use of the information is strictly prohibited. Thank you. 

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message