cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John L. Webber" <John.Web...@jentro.com>
Subject Re: Working with Weeks (to be translated to DATE > ? AND DATE < ?) for use in query
Date Fri, 12 Mar 2004 08:59:11 GMT
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...

Regards,

John

robby.pelssers@vodafone.com 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 2)
>with its startdate (05-01-04) and enddate (11-01-04).  
>
>How would i do this in java ??
>
>Kind regards,
>
>Robby
>  
>
-- 
---------------------------------------------------------
 Jentro Technologies GmbH
 John L. Webber, Software Development
---------------------------------------------------------
 Rosenheimer Str. 145e	    81671 M√ľnchen
 Tel. +49 89 189 169 80     mailto:John.Webber@jentro.com 
 Fax  +49 89 189 169 99     http://www.jentro.com
---------------------------------------------------------
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: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message