Java tutorial
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; public class Main { public static String getTime(long millisecond) { Date date = new Date(millisecond); String time = ""; if (date != null) { SimpleDateFormat df = new SimpleDateFormat("yyyy.MM.dd HH:mm"); df.setTimeZone(TimeZone.getTimeZone("GMT+08:00")); time = df.format(date); } return time; } public static String getTime(long millisecond, String format) { Date date = new Date(millisecond); String time = ""; if (date != null) { SimpleDateFormat df = new SimpleDateFormat(format); df.setTimeZone(TimeZone.getTimeZone("GMT+08:00")); time = df.format(date); } return time; } }