Java tutorial
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String getDate(String s, String format1, String format2) throws java.text.ParseException { if (s == "") return ""; SimpleDateFormat form1 = new SimpleDateFormat(format1); SimpleDateFormat form2 = new SimpleDateFormat(format2); Date date = form1.parse(s); return form2.format(date); } }