getDateAndTime bug?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

getDateAndTime bug?

John Cahill
Hi,

I'm running 1.38l on Win2000 with date and time correct
if I run

getDateAndTime(year, month, dayOfWeek, dayOfMonth, hour, minute, second,
msec);
print(month);

the output is a value of 2 not 3

I'm guessing this is a bug?

thanks,
John Cahill
Carlisle, MA
Reply | Threaded
Open this post in threaded view
|

Re: getDateAndTime bug?

Michael Schmid
Hi John,

this is not a bug:

 From the documentation of Java Date.getMonth:

public int getMonth()
Returns a number representing the month that contains or begins with  
the instant in time represented by this Date object.
The value returned is between 0 and 11, with the value 0 representing  
January.

dayOfWeek also starts with 0 (0 = Sunday, 1 = Monday,  etc),
all the others are as expected by non-Java Programmer.

http://java.sun.com/j2se/1.4.2/docs/api/java/util/Date.html

Michael
________________________________________________________________

On 15 Mar 2007, at 19:46, John Cahill wrote:

> Hi,
>
> I'm running 1.38l on Win2000 with date and time correct
> if I run
>
> getDateAndTime(year, month, dayOfWeek, dayOfMonth, hour, minute,  
> second,
> msec);
> print(month);
>
> the output is a value of 2 not 3
>
> I'm guessing this is a bug?
>
> thanks,
> John Cahill
> Carlisle, MA