• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

To extract the timezone from the system

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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());
 
Now I am super curious what sports would be like if we allowed drugs and tiny ads.
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic