Android examples for java.util:Date Format
Format date to string in yyyy-MM-dd format
import android.util.Log; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main{ /**/* w w w .java 2 s . co m*/ * get the common format time * * @param date * @return */ public static String getCommonFormat(Date date) { SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd"); return f.format(date); } }