Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8321395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T22:59:58+00:00 2026-06-08T22:59:58+00:00

I am using the Google Tasks API to return values, such as task title,

  • 0

I am using the Google Tasks API to return values, such as task title, task note, and task due date.

When I try to output the due date (stored as RFC 3339) as a string I get java.lang.IllegalArgumentException.

I am trying to use SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") to do this conversion.

My guess is that SimpleDateFormat is not the way to go but every other conversion I’ve tried has failed. I’m open to using Joda ISODateFormat but even that didn’t work. I have included the relevant snippets of code.

My task (call item) class definition is:

import com.google.api.client.util.DateTime;

public class Item {

Long id;
String title;   
String description;
String extId1;
Integer status;
DateTime dateDue;
DateTime dateLastEdit;
DateTime dateCompleted;

Item parent;

public Long getId() {
    return id;
}

public void setId(Long id) {
    this.id = id;
}

public String getTitle() {
    return title;
}

public void setTitle(String title) {
    this.title = title;
}

public String getDescription() {
    return description;
}

public void setNotes(String description) {
    this.description = description;
}

public String getExtId1() {
    return extId1;
}

public void setExtId1(String extId1) {
    this.extId1 = extId1;
}

public Integer getStatus() {
    return status;
}

public void setStatus(Integer status) {
    this.status = status;
}

public DateTime getDateDue() {
    return dateDue;
}

public void setDateDue(DateTime dateDue) {
    this.dateDue = dateDue;
}

public DateTime getDateLastEdit() {
    return dateLastEdit;
}

public void setDateLastEdit(DateTime dateLastEdit) {
    this.dateLastEdit = dateLastEdit;
}

public DateTime getDateCompleted() {
    return dateCompleted;
}

public void setDateCompleted(DateTime dateCompleted) {
    this.dateCompleted = dateCompleted;
}

public Item getParent() {
    return parent;
}

public void setParent(Item parent) {
    this.parent = parent;
}

}

To see this go wrong I demonstrate the doInBackground method where I try to output a returned date:

@Override
protected List<Item> doInBackground(Void... arg0) {
  List<Item> itemList = new ArrayList<Item>();
  DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
  Log.v(TAG, "Start doInBackground...");
  try {
      List<String> result = new ArrayList<String>();
      com.google.api.services.tasks.Tasks.TasksOperations.List listRequest = service.tasks().list("@default");
      listRequest.setFields("items/title,items/notes,items/due");
      List<Task> tasks = listRequest.execute().getItems();
      if (tasks != null) {            
          for (Task task : tasks) {
              result.add(task.getTitle());
              Item item = new Item();               
              item.setTitle(task.getTitle());
              item.setNotes(task.getNotes());
              DateTime due = task.getDue();
              item.setDateDue(due);
              Log.v(TAG, "Due date string: " + formatter.format(due));
              itemList.add(item);
          }
      } else {
          Log.v(TAG, "End doInBackground with no tasks");
          result.add("No tasks.");
      }       
      Log.v(TAG, "End doInBackground with tasks received");
      return itemList;           
  } catch (IOException e) {
      Log.v(TAG, "End doInBackground with IOException...");
      tasksSample.handleGoogleException(e);
      Item item = new Item();
      item.setTitle(e.getMessage());
      itemList.add(item);
      return itemList;
      //return Collections.singletonList(e.getMessage());
  } catch (Exception e2) {
      Log.v(TAG, "End doInBackground with generic exception...");
      e2.printStackTrace();
      Item item = new Item();
      item.setTitle(e2.getMessage());
      itemList.add(item);
      return itemList;
  } finally {
      tasksSample.onRequestCompleted();
  }
}

EDIT:

As requested, here is a stack trace:

[java.text.DateFormat.format(DateFormat.java:365), java.text.Format.format(Format.java:93), com.google.api.services.samples.tasks.android.AsyncLoadTasks.doInBackground(AsyncLoadTasks.java:78), com.google.api.services.samples.tasks.android.AsyncLoadTasks.doInBackground(AsyncLoadTasks.java:1), android.os.AsyncTask$2.call(AsyncTask.java:264), java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305), java.util.concurrent.FutureTask.run(FutureTask.java:137), android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:208), java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076), java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569), java.lang.Thread.run(Thread.java:856)]

Here is the task resource:

{“due”:”2012-07-04T00:00:00.000Z”,”notes”:”note1″,”title”:”test1″}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T23:00:01+00:00Added an answer on June 8, 2026 at 11:00 pm

    It seems that the Google Java client library helper function import com.google.api.client.util.DateTime;

    already returns a text string, no need to do a conversion. That was not was I was expecting!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have done Authentication using Google authentication API.How can I access Google task values
I want to make Task in Google Calendar using Google Calendar API : c#.
I want to create Task in Google Calendar using Google Calendar API.Using C#. Looking
I was trying to do a simple app using the Google Tasks API. Something
I'm looking at Google App Engine's new task queue API for Java and I'm
I am doing some web mining tasks using Google. Though using the ordinary Google
I am trying to use the google tasks api in a chrome extension, but
I'm working on a Google Tasks App with the new API, but I can't
I've been following the launch of the Google Tasks API, and I was just
Does anyone know if you might be able to grab google tasks using the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.