This is not a bug.
java.util.Calendar.MONTH is 0-based.
See 
http://java.sun.com/j2se/1.4.2/docs/api/constant-values.html#java.util.Calendar.JANUARY
 
<http://java.sun.com/j2se/1.4.2/docs/api/constant-values.html#java.util.Calendar.JANUARY>
 .
- Wing Yew

________________________________

From: Lewis, David [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 21, 2007 2:41 PM
To: user@xmlbeans.apache.org
Subject: Problem with XMLCalendar



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/ <http://nfis.org/> 

PFC Website / CFP Site Web: http://cfs.nrcan.gc.ca/regions/pfc 
<http://cfs.nrcan.gc.ca/regions/pfc> 

 


Notice:  This email message, together with any attachments, may contain 
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated 
entities,  that may be confidential,  proprietary,  copyrighted  and/or legally 
privileged, and is intended solely for the use of the individual or entity 
named in this message. If you are not the intended recipient, and have received 
this message in error, please immediately return this by email and then delete 
it.

Reply via email to