title: Convert MySQL DATETIME to Specific Format In Android TextView
body: <p>I recently started learning java and how to build android apps. I'm currently working on an app which uses a <code>CustomListAdapter</code> to display MySQL data parsed via json into a <code>ListView</code>. The problem I am running into is how to change the way a <code>TextView</code> displays the DATETIME from my database. As it is now, it shows the complete <code>YYYY-MM-DD HH:MM:SS</code> format, and I'm actually just trying to display <code>HH:MM A</code>. I've seen other people ask similar questions and get responses to use the <code>SimpleDateFormat</code> class, however, I am not understanding how to fit into my code. <code>due_time</code> is the column from my database that is being parsed, which I also named the <code>TextView</code> id in my layout. </p>
  
  <p>This was a snippet suggested by someone else to use:</p>
  
  <pre><code>SimpleDateFormat df1 = new SimpleDateFormat("YYYY-MM-DD");
  SimpleDateFormat df2 = new SimpleDateFormat("DD-MM-YYYY");
  try{
      Date d = df1.parse(DateString);
      System.out.println("new date format " + df2.format(d));
  }catch(Exception e){
     e.printStackTrace();
  }
  </code></pre>
  
  <p>If that would work, I'm assuming I would insert <code>due_time</code> in there somewhere, then plug the snippet into the <code>getView</code> method of my <code>CustomListAdapter</code>, shown below. Am I on the right track?</p>
  
  <pre><code>    @Override
  public View getView(int position, View convertView, ViewGroup parent) {
  
      if (inflater == null)
          inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  
      if (convertView == null)
          convertView = inflater.inflate(R.layout.list_row, null);
  
      TextView due_time = (TextView) convertView.findViewById(R.id.due_time);
  
      // getting order data for the row
      Order o = orderItems.get(position);
  
      // Due Time
      due_time.setText(o.getDueTime());
  
      return convertView;
  }
  </code></pre>