A method to return 3 formats of data
<p>I have Date in this format 2009-09-17T00:00:00.000-35:00 . As per the business Rules for my Application , i have written 3 Methods which will accept this Date and returns the Date in  MM/yyyy , yyyyMM and dd .</p>

<p>For example one method  is shown below MM/yyyy </p>

<pre><code>private String getMonthYear(String date) throws Exception {
        DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS", Locale.US);
        String s1 = date;
        String s2 = null;
        Date d;
        try {
            d = sdf.parse(s1);
            s2 = (new SimpleDateFormat("MM/yyyy")).format(d);

        } catch (ParseException e) {
            e.printStackTrace();
        }
        return s2;
    }
</code></pre>

<p>Similarly  i have other two methods which will return data in yyyyMM and dd formats ??</p>

<p>This works fine , but does not look good </p>

<p>My question is can we have only one utility which satisfies my requirement ??</p>
