get Current Time in yyyy-MM-ddHHmmssS format - Android java.util

Android examples for java.util:Date Format

Description

get Current Time in yyyy-MM-ddHHmmssS format

Demo Code

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

public class Main{

    /**// www. j a  v a  2  s  .co  m
     * yyyy-MM-ddHHmmssS
     * @return
     */
    public static String getCurTime() {
        Date date = new Date(System.currentTimeMillis());
        SimpleDateFormat dateFormat = new SimpleDateFormat(
                "yyyy-MM-ddHHmmssS");
        final String path = dateFormat.format(date);
        return path;
    }

}

Related Tutorials