I Have a bean , in that I have one property of date type.

```
private Date insurance_date;
public Date getInsurance_date() {
    return insurance_date;
}
public void setInsurance_date(Date insurance_date) {
    this.insurance_date = insurance_date;
}

```

But get method gives us a date with time so I wrote a formated method as,

```
public String getFormatedDoI() {
        DateFormat df = new SimpleDateFormat("dd-MM-yyyy");
        String stirngDate = null ;

        if(insurance_date != null)
            stirngDate = df.format((insurance_date));               
        return stirngDate;
    }

```

But the problem is I have date in db as `2014-05-21` , when I use `getFormatedDoI()` method it prints `21-00-2014`. In fact for all the dates in place of month it displays `0`. How can I get exact formated date.? and the database I am using is `mysql`. The date coming from MYSQL database.