John W. Kennedy wrote:
Z.K wrote:
>I was wondering if someone could explain something that while not a
big deal, I would not mind understanding why. When I set the Month
field with the set command with the value 1 and then use get to read
it back, it reads it as 0 and not 1.
This should not be. Please provide a complete example of what you are
doing.
This is the code. I enter a 2 for month and I get 1 using the get command.
Z.K.
-------------
GregorianCalendar d = new GregorianCalendar();
d.set(Calendar.DAY_OF_MONTH,1);
d.set(Calendar.MONTH,2);
d.set(Calendar.YEAR,2004);
d.set(Calendar.DAY_OF_YEAR,32);
System.out.printf("%d-%d-%d\nDayOfYear =
%d\n",d.get(Calendar.MONTH),d.get(Calendar.DAY_OF_ MONTH),d.get(Calendar.YEAR),d.get(Calendar.DAY_OF_ YEAR));