get Current Day in yyyy-MM-dd format - Android java.util

Android examples for java.util:Date Format

Description

get Current Day in yyyy-MM-dd format

Demo Code

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

public class Main{

    @SuppressLint("SimpleDateFormat")
    public static String getCurDay() {
        Date date = new Date(System.currentTimeMillis());
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        final String path = dateFormat.format(date);
        return path;
    }/*from ww w  . j  a v a  2s.c  o  m*/

}

Related Tutorials