1

我轻轻地得到日期时间变量的日期

List<Task> tasks = client.tasks().list("@default").execute().getItems();
if (tasks != null) {
    for (Task task : tasks) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String dat = sdf.format(task.getUpdated());
    }
}

在程序的最后一行起飞。我怎样才能得到日期task.getUpdated()

04-30 14:45:32.554: E/AndroidRuntime(17770): FATAL EXCEPTION: AsyncTask #1
04-30 14:45:32.554: E/AndroidRuntime(17770): java.lang.RuntimeException: An error occured while executing doInBackground()
04-30 14:45:32.554: E/AndroidRuntime(17770):    at android.os.AsyncTask$3.done(AsyncTask.java:200)
04-30 14:45:32.554: E/AndroidRuntime(17770):    at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:274)
04-30 14:45:32.554: E/AndroidRuntime(17770):    at java.util.concurrent.FutureTask.setException(FutureTask.java:125)
04-30 14:45:32.554: E/AndroidRuntime(17770):    at     java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:308)
04-30 14:45:32.554: E/AndroidRuntime(17770):    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
04-30 14:45:32.554: E/AndroidRuntime(17770):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
04-30 14:45:32.554: E/AndroidRuntime(17770):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
04-30 14:45:32.554: E/AndroidRuntime(17770):    at java.lang.Thread.run(Thread.java:1019)
04-30 14:45:32.554: E/AndroidRuntime(17770): Caused by: java.lang.IllegalArgumentException
04-30 14:45:32.554: E/AndroidRuntime(17770):    at java.text.DateFormat.format(DateFormat.java:365)
04-30 14:45:32.554: E/AndroidRuntime(17770):    at java.text.Format.format(Format.java:93)
04-30 14:45:32.554: E/AndroidRuntime(17770):    at com.example.ok1.AsyncLoadTasks.doInBackground(AsyncLoadTasks.java:120)
04-30 14:45:32.554: E/AndroidRuntime(17770):    at com.example.ok1.CommonAsyncTask.doInBackground(CommonAsyncTask.java:61)
04-30 14:45:32.554: E/AndroidRuntime(17770):    at com.example.ok1.CommonAsyncTask.doInBackground(CommonAsyncTask.java:1)
04-30 14:45:32.554: E/AndroidRuntime(17770):    at android.os.AsyncTask$2.call(AsyncTask.java:185)
04-30 14:45:32.554: E/AndroidRuntime(17770):    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
04-30 14:45:32.554: E/AndroidRuntime(17770):    ... 4 more
4

0 回答 0