When you print the date using System.out.println(date); or System.out.println(instance2.getTime());
, the Date
returned by instance2.getTime()
is TimeZone independent
and always prints the date in local timezone.
Instead you may want to use DateFormat/SimpleDateFormat
:
DateFormat formatter= new SimpleDateFormat("MM/dd/yyyy HH:mm:ss Z");
formatter.setTimeZone(TimeZone.getTimeZone("Europe/London"));
System.out.println(formatter.format(date));
formatter.setTimeZone(TimeZone.getTimeZone("Europe/Athens"));
System.out.println(formatter.format(instance2.getTime()))