Android examples for java.util:Date Parse
convert Time Stamp in dd MMM yyyy hh:mm:ss a format To Date
import android.content.Context; import android.provider.Settings; import android.telephony.PhoneNumberUtils; import java.io.File; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.Random; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main{ public static final String TIMESTAMP_DATE_FORMAT_12H = "dd MMM yyyy hh:mm:ss a"; public static String convertTimeStampToDate(long timeStamp) { SimpleDateFormat objFormatter = new SimpleDateFormat( TIMESTAMP_DATE_FORMAT_12H); objFormatter.setTimeZone(TimeZone.getDefault()); Calendar objCalendar = Calendar.getInstance(TimeZone.getDefault()); objCalendar.setTimeInMillis(timeStamp); String result = objFormatter.format(objCalendar.getTime()); objCalendar.clear();/* w ww .j a va 2s .c om*/ return result; } }