Hi:
I am working on a program that given a specific time in one city, calculate the corresponding time in another city. Here is what I have so far:
String tz=TimeZone.getTimeZone("America/New_York").getDisplayName();
java.text.SimpleDateFormat sdf=new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm z");
Date d=sdf.parse("2005-02-10 13:00 "+tz);
sdf.setTimeZone(TimeZone.getTimeZone("Europe/Paris"));
System.out.println("Time in Paris: "+sdf.format(d));
If I pass the start time zone and time for New York, I want to calculate the corresponding time for Paris. So, for 12:00pm NY, I would get 6pm in Paris in the winter time, but I should also get 6pm in the Summer time since both time zones adjust +1 hour. But, my code will display 7pm for Paris in June. Can someone provide help or suggestion to get the Daylight Saving Time correct? Thanks.
I am working on a program that given a specific time in one city, calculate the corresponding time in another city. Here is what I have so far:
String tz=TimeZone.getTimeZone("America/New_York").getDisplayName();
java.text.SimpleDateFormat sdf=new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm z");
Date d=sdf.parse("2005-02-10 13:00 "+tz);
sdf.setTimeZone(TimeZone.getTimeZone("Europe/Paris"));
System.out.println("Time in Paris: "+sdf.format(d));
If I pass the start time zone and time for New York, I want to calculate the corresponding time for Paris. So, for 12:00pm NY, I would get 6pm in Paris in the winter time, but I should also get 6pm in the Summer time since both time zones adjust +1 hour. But, my code will display 7pm for Paris in June. Can someone provide help or suggestion to get the Daylight Saving Time correct? Thanks.