Java tutorial
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; public class Main { public static String convertTimeInMillis2DayString(long millis) { if (millis <= 0) return "" + millis; else { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd", Locale.US); return sdf.format(new Date(millis)); } } }