get Current Date Time in yyyyMMddHHmmss format - Android java.util

Android examples for java.util:Date Compare

Description

get Current Date Time in yyyyMMddHHmmss format

Demo Code

import android.content.Context;
import android.telephony.TelephonyManager;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Main{

    public static String getCurrentlyDateTime() {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
        return dateFormat.format(new Date());
    }/*from   www.jav a2  s  .  c o  m*/

}

Related Tutorials