Android examples for java.util:Date Format
Format Date value in long type using yyyy-MM-dd format
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 }