🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #18176

Re: mystery of Date and Calendar classes

#18176
From: Richard Wilkman
Date: Tue, 04 Aug 1998 00:00
58 lines
2070 bytes
Arty:

There are issues with how the class resolves time zone based on locale
v. the machine time, etc.  There's quite a bit over in BugParade on
Javasoft and probably a couple whitepapers on it.

A lot of this type of trouble led to the deprecation of the entire
Date class.

-Rich

Arty Tsaturov wrote:
> 
> Try this:
> 
>  Date myDate = new Date(0);
>  Calendar myCalendar = Calendar.getInstance();
>  myCalendar.setTime(myDate);
> 
>  System.out.println(myCalendar.get(myCalendar.YEAR));
>  System.out.println(myCalendar.get(myCalendar.DAY_OF_YEAR));
>  System.out.println(myCalendar.get(myCalendar.HOUR_OF_DAY));
>  System.out.println(myCalendar.get(myCalendar.MINUTE));
>  System.out.println(myCalendar.get(myCalendar.SECOND));
> 
> If you think you will get
> Year: 1970
> Day of the year: 1
> Hour of Day: 0
> Minute: 0
> Second: 0
> 
> YOU ARE WRONG!!!!!
> The result will be
> Year: 1969
> Day of the year: 365
> Hour 19
> Minute 0
> Second 0
> 
> Five hours offset...
> 
> Anybody has any clue???

-- 

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Rich Wilkman
Senior Quality Assurance Engineer
Borland JBuilder Team

If you see something that looks like an opinion up there,
it's mine and mine alone.

Mail sent to me from the newsgroups won't bounce but will
be ignored.  If I have time, I'll respond, but you  have
a better chance if you confine your posts to the newsgroups
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Technical Details
Message-ID: <35C79711.5AD380B0@inprise.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <35C76F5F.2FD5@cscmail.csc.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,35b7d8d68dc9f18b
X-Google-Attributes: gidf74b3,public
From: Richard Wilkman <rwilkman@inprise.com>
Subject: Re: mystery of Date and Calendar classes
Date: 1998/08/04
Message-ID: <35C79711.5AD380B0@inprise.com>
X-Deja-AN: 377975326
Content-Transfer-Encoding: 7bit
References: <35C76F5F.2FD5@cscmail.csc.com>
Content-Type: text/plain; charset=us-ascii
Organization: Another Netscape Collabra Server User
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.language