Here you can find the source of getDateByFormatedString(String date)
public static String getDateByFormatedString(String date)
//License from project: Apache License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.Locale; import java.util.TimeZone; import android.util.Log; public class Main{ private static final String TAG = "DateUtil"; private static SimpleDateFormat formatter = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss"); public static String getDateByFormatedString(String date) { Date mDate = null;/*from w w w. j a va2s. c o m*/ String dateFormated = ""; Calendar cal = Calendar.getInstance(); if (date != null && !date.isEmpty()) { try { mDate = DateTimeUtil.stringToDate(date); } catch (ParseException e) { Log.e(TAG, "Unparsable date"); } } if (mDate != null) { cal.setTime(mDate); SimpleDateFormat dayFormat = new SimpleDateFormat("EEEE", Locale.US); SimpleDateFormat month_date = new SimpleDateFormat("MMMM"); int dayOfMonth = cal.get(Calendar.DAY_OF_MONTH); dateFormated += dayFormat.format(cal.getTime()); dateFormated += ", "; dateFormated += month_date.format(cal.getTime()); dateFormated += " " + String.valueOf(dayOfMonth); } else { } return dateFormated; } public static Date stringToDate(String date) throws ParseException { formatter.setTimeZone(TimeZone.getTimeZone("gmt")); return (formatter.parse(date)); } }