Java tutorial
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { public static String GetFormatDateYMStrByMillseconds(long milliseconds) { Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(milliseconds); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM"); return sdf.format(cal.getTime()); } }