Format Date value in long type using yyyy-MM-dd format - Android java.util

Android examples for java.util:Date Format

Description

Format Date value in long type using yyyy-MM-dd format

Demo Code

import android.support.annotation.Nullable;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class Main{

    public static String getStringDate(long timeMillis) {
        return new SimpleDateFormat("yyyy-MM-dd").format(timeMillis);
    }//from w  w  w  .j a  v  a  2  s . c o  m

}

Related Tutorials