Java tutorial
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Locale; public class Main { public static String format(long timeMillis, String pattern) { SimpleDateFormat dateFormat = new SimpleDateFormat(pattern, Locale.getDefault()); return dateFormat.format(timeMillis); } }