Java Calendar Timezone issue
Posted on 2009-05-01
Appreciate your help in pin pointing the issue in following code. I am creating a Calendar object of a specific time zone, but it is still displaying the local time zone.
e.g. I have currently US/Eastern DST
Date currentDate = new Date();
TimeZone timeZone = TimeZone.getTimeZone("Canada/Newfoundland")
Calendar calTime = Calendar.getInstance(timeZone);
I am expecting that calTime will print the current time in NewFoundLand timezone, but when I print the value of calTime.getTime() it is printing time in US Eastern. I tried to check at line 3 and line 4, at both lines it is printing US Eastern time.
What changes needed to make so that it print NewfoundLand Time? Thanks,