Android examples for java.util:Date Convert
Convert Date from one format to another
import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; public class Main{ private static final String twitterFormat = "EEE MMM dd HH:mm:ss ZZZZZ yyyy"; private static final SimpleDateFormat TWITTER_DATE_FORMATER = new SimpleDateFormat( twitterFormat, Locale.ENGLISH); private static final SimpleDateFormat DETAIL_DATE_FORMATER = new SimpleDateFormat( "HH:mm a dd MMM yy", Locale.ENGLISH); //from ww w . ja v a 2 s . c om public static String formatDate(String rawJsonDate) { try { Date date = TWITTER_DATE_FORMATER.parse(rawJsonDate); return DETAIL_DATE_FORMATER.format(date); } catch (ParseException e) { e.printStackTrace(); } return null; } }