Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Re. browser doubt

Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all!

i am using jdk1.1.5 and netscape 4.5, when i try to get the system Date it is working fine in appletviewer, but in netscape it shows date different. anyone can pl. How can i solve it?. are there any other way to do it?.
selvaraj G.
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem is in the default TimeZone.
I wrote the simple applet, that does
System.out.println(new Date(System.currentTimeMillis()));
I got the following results:
hotjava: Thu Jan 14 19:07:19 GMT 1999
netscape: Thu Jan 14 11:09:28 PST 1999
appletviewer: Thu Jan 14 19:11:03 GMT 1999
iexplore: Thu Jan 14 11:21:21 PST 1999
The different in hours is the different between PST and GMT timezones.
You can set default timezone via TimeZone.setDefault(), you just need to get the TimeZone instance for "GMT" id, and dates should be equal.

I have to say, that I failed on this. At least doing TimeZone.setDefault(TimeZone.getTimeZone("GMT")); didn't help, though GMT is one of available IDs. But I heard there are some bugs in TimeZone classes
Tick check! Okay, I guess that was just an itch. Oh wait! Just a tiny ad:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic