Java tutorial
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; public class Main { private static String getTimestamp(String pattern) { Date date = new Date(); SimpleDateFormat format = new SimpleDateFormat(pattern); format.setTimeZone(TimeZone.getTimeZone("GMT")); return format.format(date); } }