Java tutorial
//package com.java2s; import java.util.Date; import android.text.format.Time; public class Main { public static String getFormat3339ByDate(Date date, boolean isallDay) { Time time = new Time(); time.set(date.getTime()); return time.format3339(isallDay); } }