Please join us at the new JavaWorld Q&A Forums. Your existing login will work there. The discussions here are now read-only.


JavaWorld Talkback >> 958587

Pages: 1
Bipin
stranger


Reged: 07/23/08
Posts: 5
Regarding Daylight Savings
      #175858 - 07/24/08 09:50 AM

Hi guys,

I have gone through the discussions on this site regarding daylight savings in Java from Windows OS and a lot more. I am currently developing an application which involves converting the time of some remote location in the world to the system time and activate the service when the appropriate time comes.

Here are my questions :

1) The application needs to be very time sensitive. Daylight savings seasons are different in different parts of the world. Further, it may not be the same day and time when the "time shifting" is done every year. So, this would mean (I guess so) the application needs to connect to the internet and get the accurate time of the remote location every time it runs. So, how do I do it?

For example, lets say my application (the server is in New York) should trigger something in Tokyo(Japan) when the time in Tokyo is 18:45 hrs. It might not be the same time and day of the year every time daylight savings are brought into effect. For New York and Tokyo, the "time shifting" day might be different (And it can change for the next year, who knows). So, how do I exactly take the time in Tokyo and then convert into New York time.

I am trying to convert the time in Tokyo (Japan) to the Eastern Standard Time where the server is in. I am posting the code here.

String timezone = "Japan";
cityCalendar = new GregorianCalendar(TimeZone.getTimeZone(timezone));

Calendar local = new GregorianCalendar();
cityCalendar.set(Calendar.HOUR_OF_DAY, 13);
cityCalendar.set(Calendar.MINUTE, 50);

local.setTimeInMillis(cityCalendar.getTimeInMillis());
int ansH = local.get(Calendar.HOUR_OF_DAY);
int ansM = local.get(Calendar.MINUTE);

My question is will this code actually give me the exact time in Tokyo even if the daylight savings time is implemented in Tokyo? Will this give the actual time in Tokyo even after 10 years?

Thanks,

Bipin


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1



Extra information
0 registered and 1 anonymous users are browsing this forum.

Moderator:   

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      UBBCode is enabled

Rating:
Topic views: 1793

Rate this topic

Jump to

Contact us JavaWorld

Powered by UBB.threads™ 6.5.5