Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

To extract the timezone from the system

 
yathish Gatty
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am able to extract the timezone from the sytem when the system has the operating system WINDOWS XP, the timezone contains places with time but i am not able to get the timezone that will contain places with time when the system has WINDOWS 2000.

suppose i have set my system to Windows XP and I have set my system timezone to [(GMT+01:00)Amsterdam,Berlin] and by using the code i am getting the string as "Europe/Berlin". But if i set my system to Windows 2000 and set my system timezone to [(GMT+01:00)Amsterdam,Berlin] and by using the code i am getting only [(GMT+01:00)] but i need the place .
Please send me the code to obtain the places in WINDOWS 2000.

I am sending my code below:


TimeZone str=cal.getTimeZone();
localZonFromSyst=str.getID();
System.out.println(" the place is :" localZonFromSyst);


With Regards
Yathish
 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How Timezones are reported are system specific, It will report what ever String is given by the operating system. Only two pieces of data should be consistant across all systems, getRawOffset() which returns the millisecs offset from GMT without regard to Daylight savings time and getDSTSavings() which returns the number of millisecs that timezones uses for Daylight savings.

If you need to print out the Country a person has thier system set to, you need to use Locale.

System.out.println(Locale.getDefault().getCountry());
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic