title: Caused by: java.lang.IllegalArgumentException: Bad class: class java.lang.String
body: <p>I'm trying to format dates which I retrieve from my database table, I wanted to format from "2015 02 11 12 00" to "Feb 2" but it gives an error when I format it. Is there any other ways formatting those dates?</p>
  
  <p>Following the codes:</p>
  
  <pre><code>protected String doInBackground(String... args) {
          // Building Parameters
          List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;();
          // getting JSON string from URL
          JSONObject json = jParser.makeHttpRequest(url_all_events, "GET", params);
  
          // Check your log cat for JSON reponse
          Log.d("All events: ", json.toString());
  
          try {
              // Checking for SUCCESS TAG
              int success = json.getInt(TAG_SUCCESS);
  
              if (success == 1) {
                  // events found
                  // Getting Array of events
                  events = json.getJSONArray(TAG_EVENTS);
  
                  // looping through All events
                  for (int i = 0; i &lt; events.length(); i++) {
                      JSONObject c = events.getJSONObject(i);
  
                      // Storing each json item in variable
                      String id = c.getString(TAG_PID);
                      String eventname = c.getString(TAG_EVENTNAME);
                      String eventstart = c.getString(TAG_EVENTSTART);
  
                    String eventstartconvert = formatdate.format(eventstart); //this line gives an error.
  
  
                      // creating new HashMap
                      HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();
  
                      // adding each child node to HashMap key =&gt; value
                      map.put(TAG_PID, id);
                      map.put(TAG_EVENTNAME, eventname);
                      map.put(TAG_EVENTSTART,eventstartconvert);
  
                      // adding HashList to ArrayList
                      eventsList.add(map);
                  }
              }
  </code></pre>
  
  <p>Here's my logcat:</p>
  
  <pre><code>02-11 09:14:40.997  25966-26198/com.example.jithea.testlogin E/AndroidRuntime﹕ FATAL EXCEPTION: AsyncTask #2
  java.lang.RuntimeException: An error occured while executing doInBackground()
          at android.os.AsyncTask$3.done(AsyncTask.java:299)
          at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
          at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
          at java.util.concurrent.FutureTask.run(FutureTask.java:239)
          at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
          at java.lang.Thread.run(Thread.java:838)
   Caused by: java.lang.IllegalArgumentException: Bad class: class java.lang.String
          at java.text.DateFormat.format(DateFormat.java:359)
          at java.text.Format.format(Format.java:93)
          at com.example.jithea.testlogin.EventsActivity$LoadAllevents.doInBackground(EventsActivity.java:137)
          at com.example.jithea.testlogin.EventsActivity$LoadAllevents.doInBackground(EventsActivity.java:91)
          at android.os.AsyncTask$2.call(AsyncTask.java:287)
          at java.util.concurrent.FutureTask.run(FutureTask.java:234)
  </code></pre>
  
  <p>            at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
              at java.lang.Thread.run(Thread.java:838)</p>