Here you can find the source of convertDate(String str)
public static String convertDate(String str) throws ParseException
//package com.java2s; //License from project: Apache License import java.text.ParseException; import java.text.SimpleDateFormat; public class Main { public static String convertDate(String str) throws ParseException { SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd"); return sdf1.format(sdf.parse(str)); }//from w w w . j a va 2s .co m }