Android examples for java.util:Time
Get current time as MM-dd HH:mm:ss
//package com.java2s; import android.annotation.SuppressLint; import java.text.SimpleDateFormat; import java.util.Date; public class Main { /**/*w w w . j a v a 2 s .com*/ * MM-dd HH:mm:ss * @return */ @SuppressLint("SimpleDateFormat") public static String getNowMDHMSTime() { SimpleDateFormat mDateFormat = new SimpleDateFormat( "MM-dd HH:mm:ss"); String date = mDateFormat.format(new Date()); return date; } }