Android examples for java.util:Date Format
get current Date Time and format it to yyyy-MM-dd HH:mm:ss
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; public class Main { public static String getDateTime() { SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss", Locale.getDefault()); Date date = new Date(); return dateFormat.format(date); }/*from ww w . j a va 2 s. co m*/ }