Here you can find the source of formatTimestamp(long timestamp)
public static String formatTimestamp(long timestamp)
//package com.java2s; //License from project: Open Source License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; public class Main { private static final TimeZone tzUTC = TimeZone.getTimeZone("UTC"); public static String formatTimestamp(long timestamp) { Date date = new Date(timestamp); final DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); // Quoted "Z" to indicate UTC, no timezone offset df.setTimeZone(tzUTC);//w w w . j ava 2 s. c o m return timestamp + " (" + df.format(date) + ")"; } }