Here you can find the source of formatDate(String date)
public static String formatDate(String date)
//package com.java2s; //License from project: Open Source License public class Main { public static String formatDate(String date) { int i = date.indexOf(";"); String[] tokens = date.substring(0, i).split("[ -/]"); if (tokens.length == 1) return tokens[0]; if (tokens.length == 2) return tokens[0] + "-" + tokens[1]; return tokens[0] + "-" + tokens[1] + "-" + tokens[2]; }/* ww w . j a v a2 s. co m*/ }