Use the Calendar class to instantiate with GMT as the time zone.
From this you can get the time in milliseconds.
see below for sample code.
public class TimeTest { public static void main(String [] args) { Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT")); System.out.println(cal.currentTimeMillis()); } }
Hope this helps.
source share