Android examples for java.util:Calendar Format
get Date Time String from Calendar as MM/dd/yyyy hh:mm:ss format
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Locale; public class Main { public static String getDateTimeString(Calendar calendar) { SimpleDateFormat simpleDateFormat = new SimpleDateFormat( "MM/dd/yyyy hh:mm:ss", Locale.US); simpleDateFormat.setLenient(false); return simpleDateFormat.format(calendar.getTime()); }/*w w w. j ava 2s. com*/ }