Please ignore my last message. The Calendar Javadoc says: "Month value is 0-based. e.g., 0 for January.".
brain reboot. Gary -----Original Message----- From: Gary Gregory [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 22:39 To: 'Jakarta Commons Developers List' Subject: [lang] FastDateFormat Month bug? Hello all, I am working on an ISO 8601 extended date time format and I think I might have run into a bug but I would like someone else's eye to check this since I am not familiar with this implementation (which by the way I find *very* nice with the use of 'Rules', etc). I was going to commit this but I would prefer some to check my sanity. I have test cases and all that Index: FastDateFormat.java =================================================================== RCS file: /home/cvs/jakarta-commons/lang/src/java/org/apache/commons/lang/time/FastDat eFormat.java,v retrieving revision 1.8 diff -u -r1.8 FastDateFormat.java --- FastDateFormat.java 14 Jul 2003 22:25:05 -0000 1.8 +++ FastDateFormat.java 16 Jul 2003 05:33:50 -0000 @@ -998,7 +998,7 @@ } public void appendTo(StringBuffer buffer, Calendar calendar) { - appendTo(buffer, calendar.get(Calendar.MONTH) + 1); + appendTo(buffer, calendar.get(Calendar.MONTH)); } public final void appendTo(StringBuffer buffer, int value) { FYI, This is the doo-dad I am working on: /** * <p>ISO8601 formatter for the date time extended format.</p> * * <p>This format represents the Gregorian year, month, day, hour, minute, and second components defined * in � 5.5.3.2 of ISO 8601, respectively. These components are ordered in their significance by their order * of appearance i.e. as year, month, day, hour, minute, and second.</p> * * <p>The ISO8601 extended format PnYnMnDTnHnMnS, where nY represents the number of years, nM the number of months, * nD the number of days, 'T' is the date/time separator, nH the number of hours, nM the number of minutes and * nS the number of seconds. The number of seconds can include decimal digits to arbitrary precision.<.p> * * The format used is <tt>'P'yyyy'Y'M'M'd'DT'H'H'm'M's'S'</tt>. * * TODO: How does create a pattern to support <i>The number of seconds can include decimal digits to arbitrary precision.</i> * when we want to format and parse (which is not supported yet). * * @see <a href="http://www.w3.org/TR/xmlschema-2/#duration">http://www.w3.org/TR/xmlsc hema-2/#duration</a> */ public static final FastDateFormat ISO_DATETIME_EXTENDED_FORMAT = FastDateFormat.getInstance("'P'yyyy'Y'M'M'd'DT'H'H'm'M's'S'");
