get Time in yyyyMMddHHmmss format - Android java.util

Android examples for java.util:Date Time

Description

get Time in yyyyMMddHHmmss format

Demo Code

import android.annotation.SuppressLint;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Main{

    public static String getTimeName() {
        Date date = new Date();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
        return dateFormat.format(date);
    }// w  ww.j a v a2s. c o  m

}

Related Tutorials