title: Using Joda-Time Library to Convert String to DateTime Format in Google Tasks API
body: <p>I have a date/time string which needs to be sent to the Google Tasks API but I can't figure out how to convert a <a href="http://www.joda.org/joda-time/" rel="nofollow">Joda-Time</a> library <a href="http://www.joda.org/joda-time/apidocs/org/joda/time/DateTime.html" rel="nofollow">DateTime</a> object to a Java DateTime object. I'm using Android as the platform.</p>
  
  <p>The string starts off as "2012/07/19 22:00:00" and is first converted to Iso format.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>    Task task = new Task();
      task.setTitle(title);
      task.setNotes(note);        
      DateTimeFormatter formatter =  DateTimeFormat.forPattern("yyyy/MM/dd HH:mm:ss");
      DateTime dt = formatter.parseDateTime(dateToIso("2012/07/19 22:00:00"));
      task.setDue(dt);    
  
  private String dateToIso(String date) {
      date = date.replace("/", "-");
      date = replaceCharAt(date, 10, 'T');
      date = date + ".000Z";
      return date;
  }
  </code></pre>
  
  <p>The error I am getting is:</p>
  
  <blockquote>
    <p>"Type mismatch: cannot convert from org.joda.time.DateTime to
    com.google.api.client.util.DateTime"</p>
  </blockquote>
  
  <p>Please assist. Information with regards to ISO conversion would also be useful.</p>