Android examples for java.util:Date Format
get Current Date time in yy-MM-dd HH:mm:ss format
import android.annotation.SuppressLint; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.Locale; public class Main{ public static String getCurrentDatetime() { SimpleDateFormat df = new SimpleDateFormat("yy-MM-dd HH:mm:ss"); return df.format(new Date()); }/* ww w . jav a 2 s.c om*/ }