Here you can find the source of toStringFormatGMTTime(Timestamp time, String format)
public static String toStringFormatGMTTime(Timestamp time, String format)
//package com.java2s; import java.sql.Timestamp; import java.text.*; import java.util.TimeZone; public class Main { public static String toStringFormatGMTTime(Timestamp time, String format) { if (time == null) { return null; }//from w ww .ja v a 2 s . co m return toStringFormatGMTTime(time.getTime(), format); } public static String toStringFormatGMTTime(long time, String format) { SimpleDateFormat sdf = new SimpleDateFormat(format); sdf.setTimeZone(TimeZone.getTimeZone("GMT")); return sdf.format(new java.util.Date(time)); } }