0

I'm trying to parse this Date Mon Sep 21 2015 14:30:47 GMT+0000 (UTC) but I get a Parse Exception.

W/System.err﹕ java.text.ParseException: Unparseable date: "Mon Sep 21 2015 14:30:47 GMT+0000 (UTC)" (at offset 0)
W/System.err﹕ at java.text.DateFormat.parse(DateFormat.java:626)

I've tried:

             JSONObject datamsj = (JSONObject) args[0];
             try {
                    TimeZone tz = TimeZone.getTimeZone("UTC");
                    TimeZone tz2 = TimeZone.getTimeZone("America/Bogota");
                    Calendar cal = Calendar.getInstance(tz);
                    SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd yyyy HH:mm:ss zZ (z)");
                    sdf.setCalendar(cal);
                    cal.setTime(sdf.parse(datamsj.getString("fc")));

                    cal.setTimeZone(tz2);
                    Date date = cal.getTime();
                    DateFormat df = new SimpleDateFormat("HH:mm a");
                    messageTextDate = df.format(date);
                    messageText = datamsj.getString("msj");
                } catch (Exception e) {
                    e.printStackTrace();
                    return;
                }

But doesn't works so the question is: What is the format that I have to use to parse that Date?

Jhony Blaze
  • 251
  • 1
  • 5
  • 15

0 Answers0