Why are months off by one with Java SimpleDateFormat ?

Posted by Natim on Stack Overflow See other posts from Stack Overflow or by Natim
Published on 2010-06-07T19:15:36Z Indexed on 2010/06/08 11:42 UTC
Read the original article Hit count: 275

Filed under:
|
|

Hello,

I am using SimpleDateFormat to display a Calendar like this :

public String getDate()
{
    String DATE_FORMAT = "EEEE, dd/MM/yyyy HH:mm:ss";
    SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
    System.err.println(date.getTime().getMonth());
    return sdf.format(date.getTime());
}

The shell returns 6 and the display : mardi, 06/07/2010 12:44:52

It can't be possible ? Why ?

Thanks

© Stack Overflow or respective owner

Related posts about java

Related posts about date