I'm trying to convert GMT to EST a simple process , but the output of EST shows one hour less than then the current time as searched in google, Can anyone suggests me as why is that so.
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.TimeZone;
public class Example {
public static void main(String[] args) {
TimeZone tz=TimeZone.getDefault();
Calendar cal=new GregorianCalendar();
cal.setTimeZone(tz);
Date date = cal.getTime();
DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy K:mm a");
System.out.println("GMT TIME "+dateFormat.format(date));
TimeZone estTime = TimeZone.getTimeZone("EST");
dateFormat.setTimeZone(estTime);
String submittedDate = dateFormat.format(date);
System.out.println("EST TIME "+submittedDate);
}
}
Above example code