Java tutorial
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String num_format(long time, String type) { SimpleDateFormat sdf = new SimpleDateFormat(type); String date = sdf.format(new Date(time)); return date; } }