Here you can find the source of formatToUTC(long datetime)
public static String formatToUTC(long datetime)
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String formatToUTC(long datetime) { return formatLongTime(datetime, "yyyyMMdd'T'HHmmss'Z'"); }/*from w ww . jav a 2 s . c o m*/ public static String formatLongTime(long datetime, String format) { SimpleDateFormat formatter = new SimpleDateFormat(format); return formatter.format(new Date(datetime)); } }