Date date = new Date();
DateFormat format = new SimpleDateFormat("dd/MM/yy h:mm a zzz");
format.setTimeZone(TimeZone.getTimeZone("America/New_York"));
String currentTimeInEST = format.format(date);
The above code gets me the current time in the required timezone. However, I am not able to convert currentTimeInEST
back to Date
object and print the date and time in EST. It is getting converted to default time zone. I could not find any possible ways in any forum.
– PlanetSaro Dec 30 '14 at 11:15