Java tutorial
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { /** * * @param pattern * @param seconds * @return */ public static String getTimeStr(String pattern, int seconds) { SimpleDateFormat sdf = new SimpleDateFormat(pattern); return sdf.format(new Date(seconds * 1000L)); } }