The ISO8601 value you are defining is the a Duration format, not the
DateTime format. So a better name would be good.

>From ISO8601:
- Time-interval: a portion of time between two time-points. These
time-points are respectively labelled "start"
and "end". Time intervals may be specified by these two time-points, by one
of these time-points and the
temporal distance between the points or by the temporal distance between
these points only.

- Recurring time-interval: a series of consecutive time-intervals of the
same duration. Recurring time-intervals
may be specified by specification of one time-interval and the number of
recurrences.

- Duration: a quantity ("length") of time. Duration is a physical unit
expressed in the units of time of the
International System of Units (SI), as defined in ISO 31-1.

Your format is a Duration as it has no start or end time. Note that this
means it should go in DurationFormatUtils, not DateFormatUtils.

Stephen

----- Original Message -----
From: "Gary Gregory" <[EMAIL PROTECTED]>
To: "'Jakarta Commons Developers List'" <[EMAIL PROTECTED]>
Sent: Wednesday, July 16, 2003 6:39 AM
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'");



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to