Here you can find the source of formatUTC(Date date, String format)
public static String formatUTC(Date date, String format)
//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 final String FORMAT_TIME_DEFAULT = "yyyy-MM-dd hh:mm:ss z"; public static String formatUTC(Date date, String format) { SimpleDateFormat sdf = new SimpleDateFormat(format); sdf.setTimeZone(TimeZone.getTimeZone("UTC")); return sdf.format(date); }// w w w . j av a2 s. c om public static String formatUTC(Date date) { return formatUTC(date, FORMAT_TIME_DEFAULT); } }