Get current time as MM-dd HH:mm:ss - Android java.util

Android examples for java.util:Time

Description

Get current time as MM-dd HH:mm:ss

Demo Code


//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;
    }
}

Related Tutorials