Article View: borland.public.jbuilder.java.language
Article #7876Re: Problem with time zones ...
From: Rich Wilkman
Date: Thu, 10 May 2001 15:50
Date: Thu, 10 May 2001 15:50
46 lines
2857 bytes
2857 bytes
Edwin:
Show us the code where you create the myFormatter object. The Java time
funcs should deal just fine with DST unless you are in one of the
civilized portions of the world that simply ignore it.
BTW, does it work correctly if you get the time from a Calendar object
instead of a Date object?
-Rich
"Edwin G๏ฟฝnthner" wrote:
>
> Hi John,
>
> >It would help if you would tell us in which way it fails. Does it
> >throw an exception? Print out incorrect results? Crash your hard
> >drive? :o)
>
> First it killed my dog then it screw up my television set ...
>
> No, the only problem is that it print outs incorrect results. ;-)
> Code is quite simple:
>
> Date date = new Date();
> System.out.println(myFormatter.format(date));
>
> On my machine, it gives me the correct time,
> on the other machine, it gives me correct time + one hour.
>
> I assume that Java ignores this one flag ("change according to
> daylight saving times automatically") that you can setup in
> Windows Date settings.
>
> If I switch of this feature on my machine, the Windows clock will
> show me "correct time - one hour". I assume that Java always takes this
> time and adds one hour. Correct for my machine, but not correct
> if you switch off the windows flag and tell your machine the exact time
> (meaning: the user changes the clock if daylight saving time changes - and not
> the system).
>
> Maybe a table makes it more clear:
>
> actual time windows time (internal) windows external Java
> my machine 10:00 9:00 9 + 1 -> 10:00 9+1-> 10:00
> customer 10:00 10:00 10 + 0 -> 10:00 10+1 -> 11.00
Technical Details
Message-ID:
<3AFAB8D7.B7968276@formlessvoid.com>Path:
arc1-ca.pugleaf.net!newsfeed.google.com!sn-xit-03!supernews.com!cyclone-sjo1.usenetserver.com!news-out-sjo.usenetserver.com!e420r-sjo4.usenetserver.com!news-out.usenetserver.com!newsfeed.skycache.com!Cidera!news.maxwell.syr.edu!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!dnewsReferences:
<3af7da0f$1_2@dnews> <MPG.1562bdeacce5495b98a1b2@forums.borland.com> <3afa34d2$1_1@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: f74b3,a59c8cd977ce05a X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-05-10 09:12:23 PST Message-ID: <3AFAB8D7.B7968276@formlessvoid.com> Date: Thu, 10 May 2001 08:50:48 -0700 From: Rich Wilkman <richw@formlessvoid.com> X-Mailer: Mozilla 4.77 [en] (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language Subject: Re: Problem with time zones ... References: <3af7da0f$1_2@dnews> <MPG.1562bdeacce5495b98a1b2@forums.borland.com> <3afa34d2$1_1@dnews> Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit NNTP-Posting-Host: 208.236.69.60 X-Trace: dnews 989509848 208.236.69.60 (10 May 2001 08:50:48 -0700) Lines: 46 Path: arc1-ca.pugleaf.net!newsfeed.google.com!sn-xit-03!supernews.com!cyclone-sjo1.usenetserver.com!news-out-sjo.usenetserver.com!e420r-sjo4.usenetserver.com!news-out.usenetserver.com!newsfeed.skycache.com!Cidera!news.maxwell.syr.edu!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!dnews