I am trying to covert timezone from EST to IST in intellij IDEA, SO after conversion I am getting difference of 10 hr 30 min but when I am running same program with eclipse I am getting difference of 9 hr 30 min which is correct, regarding time difference you can check on google.
please refer the below code
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
simpleDateFormat.setTimeZone(TimeZone.getTimeZone("EST"));
Date dateValue = simpleDateFormat.parse("2015-09-15 05:00:00.000 EST");
System.out.println(dateValue);
Output:
Correct value - Tue Sep 15 14:30:00 IST 2015
Wrong value - Tue Sep 15 15:30:00 IST 2015
Please suggest reason behind this.
I suspect you actually want a time zone for Eastern Time, e.g. America/New_York. After all, Eastern Time wasn't observing EST on September 15 - it was observing EDT (at least, anywhere that observes daylight savings, which most of Eastern Time does as far as I'm aware).
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
simpleDateFormat.setTimeZone(TimeZone.getTimeZone("America/New_York"));
Date dateValue = simpleDateFormat.parse("2015-09-15 05:00:00.000");
simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
System.out.println(simpleDateFormat.format(dateValue));
This gives output of 2015-09-15 09:00:00, showing that America/New_York is indeed 4 hours behind UTC at the moment (and hence 9.5 hours behind India).
Now that's assuming you know that you really want it to be in Eastern time - which is why I removed the " EST" suffix from the string you're parsing. If you actually want to get the value from the string, you'll need to be very careful, given that those abbreviations are ambiguous - and in this case, apparently misapplied.
See more on this question at Stackoverflow