Here you can find the source of getTimestamp()
private static String getTimestamp()
//package com.java2s; //License from project: Open Source License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; public class Main { private static final ThreadLocal<DateFormat> dfs = new ThreadLocal<DateFormat>(); private static String getTimestamp() { DateFormat df = dfs.get(); if (df == null) { TimeZone tz = TimeZone.getTimeZone("UTC"); df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); df.setTimeZone(tz);/* w w w . ja v a 2 s . c o m*/ dfs.set(df); } return df.format(new Date()); } }