Get date , month and year from particular date
<p>I want to get the date , month and year from the particular date.</p>

<p>I have used below code :</p>

<pre><code> String dob = "01/08/1990";

        int month = 0, dd = 0, yer = 0;

        try {

            SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
            Date d = sdf.parse(dob);
            Calendar cal = Calendar.getInstance();
            cal.setTime(d);
            month = cal.get(Calendar.MONTH);
            dd = cal.get(Calendar.DATE);
            yer = cal.get(Calendar.YEAR);

        } catch (Exception e) {
            e.printStackTrace();
        }
</code></pre>

<p>So from the above code i am getting <code>month -0 , yer - 1990 and date - 8</code></p>

<p>But i want <code>month - 01 , date - 08 and yer - 1990</code>.</p>

<p>I have defined the date format also but i am not getting perfect value from date, month and year.</p>