Java tutorial
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; public class Main { /** * Converts a Date to the GMT timezone and formats it to the format yyyy-MM-dd HH:mm:ssZ. * * @param date the Date to parse. * @return A formatted date string. */ public static String getLongGmtDateString(Date date) { if (date == null) { return null; } SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); return simpleDateFormat.format(date); } }