Article View: borland.public.jbuilder.java.language
Article #20039Re: dates - invalid conversion!!
From: Kurt A. Zarefoss
Date: Wed, 05 Nov 1997 00:00
Date: Wed, 05 Nov 1997 00:00
40 lines
1351 bytes
1351 bytes
I have noticed this too. All of the date class documentation states that
days start from 1-31. However, whenever you run it through a format
class, it looses a day. I thing the Date class starts at one, but the
SimpleDateFormat class starts at zero.
Just a hunch...either way it is a bug!
Kurt
Bryan Chalmers wrote:
> I have the following piece of code is supposed to format a date (d) as
> dd/mm/yyy
>
> System.out.println("date before is " + d);
> SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
> System.out.println("date after is " + df.format(d));
>
> This gives the following output.
> date before is 1958-11-20
> date after is 19/11/1958
>
> I seem to have lost a day in the conversion. Can anyone tell me what I
> am doing wrong?
>
> Regards,
> Bryan Chalmers
> Texaco North Sea (UK) Company
> Aberdeen
> chalmbr@texaco.com
--
Kurt A. Zarefoss
hawk@fred.net
Technical Details
Message-ID:
<3460B61B.7B55105A@my.signature>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<3460a708.11625096@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,aa85914ad822cd30 X-Google-Attributes: gidf74b3,public From: "Kurt A. Zarefoss" <see@my.signature> Subject: Re: dates - invalid conversion!! Date: 1997/11/05 Message-ID: <3460B61B.7B55105A@my.signature> X-Deja-AN: 287230054 References: <3460a708.11625096@forums.borland.com> Organization: None Newsgroups: borland.public.jbuilder.java.language