Hi,
I am trying to make a little program that will print out the times of cities around the world. To do this I am creating different Calendar objects. Here is what I have so far:
//This will get the time in Raleigh, NC (Local Time)
Calendar raleighTime = Calendar.getInstance();
Date d = raleighTime.getTime();
SimpleDateFormat formatter = new SimpleDateFormat ("hh:mm a zzz");
String dateString = formatter.format(d);
System.out.print(dateString);
//This will get the time in Paris, France
Calendar parisTime =
Calendar.getInstance(tz.getTimeZone("Europe/Paris"));
Date parisDate = parisTime.getTime();
String parisDateString = formatter.format(parisDate);
System.out.print(parisDateString);
Maybe I just don't understand what I am doing :-) but I would think that because I put in the TimeZone object of Europe/Paris that when I use the getTime() method
Java will return the local time adjusted for Paris. No, nothing is that simple. It prints out the local time (in North Carolina). I can't figure out how to get the time in Paris (I know that I could add 6 hours, but this would not adjust for Daylight Savings Time). Can anyone lend a helping hand??
Thanks,
Buck