🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

SimpleDateFormat

#18715
From: Gregory S. Lipman
Date: Sat, 02 May 1998 00:00
22 lines
1094 bytes
Hi 
This question probably was asked before but I missed it
I am using Jbuilder 1 with patch
I do not know if it's relevant though.

I have a string like "01011996"
I need to convert it to Date.
In SimpleDateFormat documentation there is a code example :

String str = new String();
str = "01011960";
SimpleDateFormat formatter = new SimpleDateFormat("MMddyyyy");
ParsePosition pos = new ParsePosition(0);
Date dt = formatter.parse(str,pos);

It produces NullPointerException !!!
What am I doing wrong.
Is there other wat from "01011960" to Date in JDK 1.1

Thanks a lot,
 Gregory
Technical Details
Message-ID: <354BE8B5.3E72@concentric.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,b55d91ab529bfca5,start
X-Google-Attributes: gidf74b3,public
From: "Gregory S. Lipman" <glipman@concentric.net>
Subject: SimpleDateFormat
Date: 1998/05/02
Message-ID: <354BE8B5.3E72@concentric.net>
X-Deja-AN: 349718689
Content-Transfer-Encoding: 7bit
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Organization: Another Netscape Collabra Server User
Newsgroups: borland.public.jbuilder.java.language