Here you can find the source of str2Time(String str)
public static String str2Time(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 str2Time(String str) { SimpleDateFormat sdf = new SimpleDateFormat( "EEE MMM dd HH:mm:ss zzz yyyy", Locale.US); Date date = null;//from ww w. j a va2 s.c om try { date = (Date) sdf.parse(str); } catch (ParseException e) { e.printStackTrace(); } String formatStr = new SimpleDateFormat("HH:mm").format(date); return formatStr; } }