Java tutorial
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Locale; import java.util.TimeZone; public class Main { private static SimpleDateFormat serverDateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US); public static String getServerTime() { Calendar calendar = Calendar.getInstance(); serverDateFormat.setTimeZone(TimeZone.getTimeZone("GMT")); return serverDateFormat.format(calendar.getTime()); } }