Problems while retrieving the UNIX timestamp from the Calendar class
// Time according to the local timezone
Calendar c1 = Calendar.getInstance();
out.println("Local time: ");
out.println("Epoch time: " + c1.getTimeInMillis());
out.println("Hour: " + c1.get(c1.HOUR_OF_DAY));
out.println("Minute: " + c1.get(c1.MINUTE));
out.println("Second: " + c1.get(c1.SECOND));
// Time according to the Indian timezone
Calendar c2 = Calendar.getInstance(TimeZone.getTimeZone("Asia/Calcutta"));
out.println("India time: ");
out.println("Epoch time: " + c2.getTimeInMillis());
out.println("Hour: " + c2.get(c1.HOUR_OF_DAY));
out.println("Minute: " + c2.get(c1.MINUTE));
out.println("Second: " + c2.get(c1.SECOND));
Please read the code snippet given above.
First I get the Calendar object (variable c1 in the snippet) according to the local timezone. Then I get the Calendar object and set it to the Indian timezone (variable c2 in the snippet). The hours, minutes and seconds displayed by the Calendar object represented by c2 is correct according to the Indian timezone. However, getTimeInMillis() continues to display the "epoch time" according to the local timezone and doesn't show the it according to the Indian timezone.
Is this a bug or known issue with the implementation of the Calendar class ?
Any solutions or workarounds ?
Please HALP!

