Here you can find the source of getTimestamp()
public static String getTimestamp()
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; public class Main { public static String getTimestamp() { final Date date = new Date(); final String ISO_FORMAT = "yyyy-MM-dd'T'HH:mm:ssz"; final SimpleDateFormat sdf = new SimpleDateFormat(ISO_FORMAT); final TimeZone utc = TimeZone.getTimeZone("UTC"); sdf.setTimeZone(utc);//from w w w. j a va2s . c om String timeStamp = sdf.format(date); return timeStamp.replace("UTC", "Z"); } }