Java tutorial
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; public class Main { /** * TO get current time(GMT) * * @return current time at specific time zone */ public static String UtcDateNow() { SimpleDateFormat formatUTC = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); formatUTC.setTimeZone(TimeZone.getTimeZone("EST5EDT")); return formatUTC.format(new Date().getTime()); } }