Here you can find the source of formatDate(String date)
public static String formatDate(String date)
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static final String INPUT_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss"; public static String formatDate(String date) { SimpleDateFormat input = new SimpleDateFormat(INPUT_DATE_FORMAT); SimpleDateFormat output = new SimpleDateFormat( "dd/MM/yyyy HH::mm:ss"); Date d;/*from w ww . j a v a2 s. c om*/ try { d = input.parse(date); return output.format(d); } catch (ParseException e) { e.printStackTrace(); return ""; } } }