The Artima Developer Community
Sponsored Link

Time methods, same method different result?

Advertisement

Advertisement

This page contains an archived post to the Design Forum (formerly called the Flexible Java Forum) made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

Time methods, same method different result?

Posted by Gerwin Brink on 07 Oct 1998, 2:58 AM

I�m having some problems with an Applet which should show the current hour.
I get 3 different results depending on how and where I run the Applet.

When I use the (deprecated) method:

dat=new Date();
hour=dat.getHour();

The results are:
Appletviewer = current time
Netscape, class on local HD = current time +1
Netscape, class on server = current time +2

when I use the 1.1 method:

GregorianCalendar cal = new GregorianCalendar();
dat = new Date();
((Calendar) cal).setTime( dat );
hour = ((Calendar) cal).get(HOUR);

The results are:
Appletviewer = current time -1
Netscape, class on local HD = current time
Netscape, class on server = current time +1

Can anybody please explain, or look on my page http://home.wxs.nl/~gwbrink/
what results you got?

Gerwin Brink



Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us