Here you can find the source of str2Date(String str)
public static String str2Date(String str)
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; public class Main { public static String str2Date(String str) { SimpleDateFormat sdf = new SimpleDateFormat( "EEE MMM dd HH:mm:ss zzz yyyy", Locale.US); Date date = null;/* w w w . j a va 2 s . com*/ try { date = (Date) sdf.parse(str); } catch (ParseException e) { e.printStackTrace(); } String formatStr = new SimpleDateFormat("yy-MM-dd").format(date); return formatStr; } }