Here you can find the source of parse2DateString(String date)
public static String parse2DateString(String date)
//package com.java2s; /*//from www .jav a2 s . co m * =========================================================================== * Copyright 2007 WEBTRANING Corp. All Rights Reserved. * WEBTRANING PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * =========================================================================== * @version 1.0, 2007-8-11 * @author Jack Chen * =========================================================================== * */ import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String parse2DateString(String date) { DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); Date d = null; try { d = df.parse(date); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } return df.format(d); } }