Java tutorial
//package com.java2s; import android.text.TextUtils; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String getFormatDayTime(String time) { if (TextUtils.isEmpty(time)) return null; return getFormatDayTime(Long.valueOf(time)); } public static String getFormatDayTime(Long time) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); Date date = new Date(time); return dateFormat.format(date); } }