Here you can find the source of getCurrentTimeStamp()
public static String getCurrentTimeStamp()
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; public class Main { public static final String TIME_FORMAT = "yyyy-MM-dd HH:mm:ss.SSS"; public static final String GMT_TIME_ZONE = "GMT"; /**/* w ww.j a v a 2s . c om*/ * Description - method to get current time stamp in GMT * @return timeAsString */ public static String getCurrentTimeStamp() { // set the date format to standard format SimpleDateFormat dateFormat = new SimpleDateFormat(TIME_FORMAT); // set GMT time zone dateFormat.setTimeZone(TimeZone.getTimeZone(GMT_TIME_ZONE)); // create a date object Date date = new Date(); // return the current time stamp return dateFormat.format(date); } }