Hi David,
I ran into this sometime ago, but I think its by design.
Calendar.MONTH starts at 0 and not January == 1.
http://java.sun.com/j2se/1.4.2/docs/api/java/util/Calendar.html#MONTH
whereas Calendar.DATE starts at 1.

Hope this helps,
-Jacob Danner

So I think you are getting the expected behavior

On 9/21/07, Lewis, David <[EMAIL PROTECTED]> wrote:
>
>
>
>
> I seem to be having a problem with getting the month value from an
> XmlCalendar object. For example, if I have a XmlObject (sourceMember) that
> contains a "date" attribute:
>
>
>
> Calendar metDate = sourceMember.getDate();
>
> System.out.println(metDate);
>
> System.out.println((metDate.get(Calendar.YEAR) + ", " +
>
> metDate.get(Calendar.MONTH) + ", " +
>
>             metDate.get(Calendar.DATE)));
>
>
>
> Produces the following output:
>
> 1999-09-12-07:00
>
> 1999, 8, 12
>
>
>
> Regardless of the value of the attribute, the
> metDate.get(Calendar.MONTH)always returns a month value that is one month
> less than it should be. Is this a bug, or am I doing something wrong?
>
>
>
> Any suggestions?
>
>
>
> David Lewis
>  Software Developer – National Forest Information System/
>
> Concepteur de logiciels – Système national d'information forestière
>
>
>
> Natural Resources Canada                     Ressources naturelles Canada
>
>
> Canadian Forest Service.                       Service canadien des forêts
>
> 506 West Burnside Road                  506, chemin ouest Burnside
>
> Victoria, B.C. V8Z 1M5                           Victoria, (C.-B.), V8Z 1M5
>
>
>
> Telephone:  (250) 363 0710                    Téléphone:  (250) 363 0710
>
> Facsimile:   (250) 363 0775                     Télécopier:  (250) 363 0775
>
> Email: dlewis@ pfc.cfs.nrcan.gc.ca       Courriel:
> [EMAIL PROTECTED]
>
>
>
> NFIS Website / SNIF Site Web: http://nfis.org/
>
> PFC Website / CFP Site Web:
> http://cfs.nrcan.gc.ca/regions/pfc
>
>

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

Reply via email to