IT Certificaions

Google Cloud Platform

Tuesday, July 19, 2011

How to Converts YYYY-MM-DD to dd.MM.yyyy format in java as date in String

  Converts YYYY-MM-DD to dd.MM.yyyy format in java as (date in String)
=========================================================
public static String getDateFormatDDMMYYY(String dateStr) {
        String[] dateParts = dateStr.split("-");
        StringBuffer sb = new StringBuffer();
        for (int ii=dateParts.length-1; ii>0; ii--) {
          sb.append( dateParts[ii] + "." );
        }
        sb.append( dateParts[0] );
        return sb.toString();
    }
===========================================================