• Post Reply Bookmark Topic Watch Topic
  • New Topic

Time Zone Problem  RSS feed

 
Jo Joseph
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends

Since I dont have much experience in development, If somebody can help me in solving this scenario it will be very helpful

My machine have Indian standard time zone. I want to update the time in the application so that I can call my customers who are residing in diffrent standard time zones on the particular time which I update.

My server is located in Us tome zone.

Is there any APIs to localize each timing just like i18.

Can any one help me to find a link or any book so that in can work on this issue
 
Tony Docherty
Bartender
Posts: 3271
82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you create a java.util.Calendar object to manipulate the time you can create one for any time zone you want by specifying the TimeZone you want to use.
 
Jo Joseph
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since my server is in a particular time zone, How can I poke the persons in different time zone.
 
Paul Clapham
Sheriff
Posts: 22841
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know what "poke" means.

But if you want to display a date in a human-readable format, you use a SimpleDateFormat object to display it. If you want to display the date as if it were in some other time zone, not your system's default time zone, then you create a TimeZone object for that timezone and use the setTimeZone() method of SimpleDateFormat to make the latter object display a date as if it were in that time zone.

So here's what I suggest: Have a look at the API documentation for the TimeZone class. Play around with the methods in that class by writing some small practice programs. In particular try to write a program which displays a full list of all the time zones which Java supports. Then try to write some code which creates a TimeZone object for a particular time zone which you're interested in. And for background read the Wikipedia article tz database which talks about a "database" of time zone information -- that's the "database" which Java uses.

Then when you understand what's going on there, start playing around with SimpleDateFormat. You may already be using that, but if you aren't then you should be. Write a small program which displays a date in several different time zones, using TimeZone and SimpleDateFormat objects.
 
Tony Docherty
Bartender
Posts: 3271
82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dates and times in Java are stored as a millisecond offset from the epoch (January 1, 1970 00:00:00.000 GMT (Gregorian)), run the following code to see how the timezone setting just changes the view but note how the miiliseconds are all relative to epoch.
 
Jo Joseph
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you all....
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!