If you don't need the time portion, I once wrote a replacement for the calendar that handles just dates. Unlike all of the bizarre manipulations required by a calendar, with mine you can just call object.add(7) to add 7 days to a date. It uses an internal Julian date field. Checking for elapsed number of days is a straight integer subtraction. It pretty closely mimics the date capabilities of xBase variants. Personally, I never use calendars. They are just too obtuse and error prone. If you are interested you can view the Javadocs at:
http://www.mhsoftware.com/resources/jar/doc/ The class name is SaneDate. Right now, it's GPLd but I plan on changing the license to LGPL. George Sexton MH Software, Inc. Home of Connect Daily Web Calendar Software http://www.mhsoftware.com/connectdaily.htm Voice: 303 438 9585 -----Original Message----- From: Andreas Probst [mailto:andpro77@;gmx.net] Sent: 11 November, 2002 12:43 AM To: Tomcat Users List Subject: Re: Java returns bunk date!? Hi Josh, yes it is, but in my opinion it's a bit hidden. As starting January with 0 isn't what one would expect, it should be stressed more in the docs. in java.util.Calendar: public static final int MONTH Field number for get and set indicating the month. This is a calendar-specific value. The first month of the year is JANUARY which is 0; the last depends on the number of months in a year. in java.util.GregorianCalendar public GregorianCalendar(int year, int month, int date) Constructs a GregorianCalendar with the given date set in the default time zone with the default locale. Parameters: year - the value used to set the YEAR time field in the calendar. month - the value used to set the MONTH time field in the calendar. Month value is 0-based. e.g., 0 for January. date - the value used to set the DATE time field in the calendar. Andreas On 11 Nov 2002 at 10:15, Josh G wrote: > Ah thanks. Is this covered in the docs and I just missed it? > > -Josh > -- > And can you tell me doctor why I still can't get to sleep? > And why the channel 7 chopper chills me to my feet? > And what's this rash that comes and goes, can you tell me what it > means? God help me, I was only 19 > > > ----- Original Message ----- > From: "Chakradhar Tallam" <[EMAIL PROTECTED]> To: > "'Tomcat Users List'" <[EMAIL PROTECTED]> Sent: > Monday, November 11, 2002 9:44 AM Subject: RE: Java returns bunk > date!? > > > > because java's month index starts from 0 & ends at 11. > > > > 0 - JAN > > 1 - FEB > > ... > > 11 - DEC > > > > -----Original Message----- > > From: Josh G [mailto:josh@;gfunk007.com] > > Sent: Monday, 11 November 2002 10:41 AM > > To: Tomcat Users List > > Subject: Java returns bunk date!? > > > > > > I'm having a weird problem with tomcat, java is giving me last > > month's > date! > > It's 11 nov on this machine, but java is returning 11 oct :( I > > don't see > how > > this could happen? > > > > -Josh > > -- > > And can you tell me doctor why I still can't get to sleep? And > > why the channel 7 chopper chills me to my feet? And what's this > > rash that comes and goes, can you tell me what it means? God > > help me, I was only 19 > > > > > > > > -- > > To unsubscribe, e-mail: > > <mailto:tomcat-user-unsubscribe@;jakarta.apache.org> > > For additional commands, e-mail: > > <mailto:tomcat-user-help@;jakarta.apache.org> > > > > > -- > To unsubscribe, e-mail: > <mailto:tomcat-user-unsubscribe@;jakarta.apache.org> For > additional commands, e-mail: > <mailto:tomcat-user-help@;jakarta.apache.org> > -- To unsubscribe, e-mail: <mailto:tomcat-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:tomcat-user-help@;jakarta.apache.org> -- To unsubscribe, e-mail: <mailto:tomcat-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:tomcat-user-help@;jakarta.apache.org>
