Android examples for java.util:Calendar
Format Calendar to string in yyyy-MM-dd kk:mm.ss format
import java.text.SimpleDateFormat; import java.util.Calendar; public class Main{ private static SimpleDateFormat dateFormatSql = new SimpleDateFormat( "yyyy-MM-dd kk:mm.ss"); public static String dateToSqlStr(Calendar date) { return dateFormatSql.format(date.getTime()); }/*from ww w.ja v a2 s . c om*/ }