Here you can find the source of convertDate(String inPattern, String outPattern, String date)
public static String convertDate(String inPattern, String outPattern, String date) throws Exception
//package com.java2s; /*// w ww .ja va2 s .co m * Copyright (c) Mirth Corporation. All rights reserved. * http://www.mirthcorp.com * * The software in this package is published under the terms of the MPL * license a copy of which has been included with this distribution in * the LICENSE.txt file. */ import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String convertDate(String inPattern, String outPattern, String date) throws Exception { Date newDate = getDate(inPattern, date); return formatDate(outPattern, newDate); } public static Date getDate(String pattern, String date) throws Exception { SimpleDateFormat formatter = new SimpleDateFormat(pattern); return formatter.parse(date); } public static String formatDate(String pattern, Date date) { SimpleDateFormat formatter = new SimpleDateFormat(pattern); return formatter.format(date); } }