Here you can find the source of getLongGmtDateString(Date date)
Parameter | Description |
---|---|
date | the Date to parse. |
public static String getLongGmtDateString(Date date)
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; public class Main { /**// w w w . j ava2 s. c o m * 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); } }