Here you can find the source of convertDateStringToString(String strDate, String currentFormat, String parseFormat)
public static String convertDateStringToString(String strDate, String currentFormat, String parseFormat)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String convertDateStringToString(String strDate, String currentFormat, String parseFormat) { try {// w w w . j a v a 2s . c o m return convertDateToString(convertStringToDate(strDate, currentFormat), parseFormat); } catch (Exception e) { e.printStackTrace(); return null; } } public static String convertDateToString(Date objDate, String parseFormat) { try { return new SimpleDateFormat(parseFormat).format(objDate); } catch (Exception e) { e.printStackTrace(); return ""; } } public static Date convertStringToDate(String strDate, String parseFormat) { try { return new SimpleDateFormat(parseFormat).parse(strDate); } catch (Exception e) { e.printStackTrace(); return null; } } }