The moose likes Java in General and the fly likes ONE MORE TIME!  Date from String, etc.. Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "ONE MORE TIME!  Date from String, etc.." Watch "ONE MORE TIME!  Date from String, etc.." New topic
Author

ONE MORE TIME! Date from String, etc..

Sam Smoot
Ranch Hand

Joined: Apr 18, 2002
Posts: 237
I know I've done the search, but even the answers don't work.
I need to convert an item from a text file to a Date and am using the following coder to do it.

The code to read it is:

The data is :

Mike,Bright,Essays on Soap,8/27/2002
John,Smith,When I Am Clean,8/27/2002
John,Smith,Essays on Soap,8/27/2002
Sally,Baker,Essays on Soap,8/28/2002
Mike,Bright,When I Am Clean,8/29/2002

and the dates I get as a result are JAN 27, 2002, etc...
HELP!! :roll:


CNSS/NSA Infosec Professional,<br />Software Engineer
Hari Gangadharan
Ranch Hand

Joined: Mar 08, 2001
Posts: 73
You are using the wrong pattern. The correct code is:

Also it is better to create only one instance of SimpleDateFormatter. Hope this helps.
[ February 05, 2003: Message edited by: Hari Gangadharan ]

<B>Hari Gangadharan</B><BR>Unix is user friendly..<BR>but it chooses to whom it is friendly with!
Sam Smoot
Ranch Hand

Joined: Apr 18, 2002
Posts: 237
That Worked!
THANKS
 
 
subject: ONE MORE TIME! Date from String, etc..
 
Threads others viewed
xsd datetime format
dates and JDBC
How to Convert String "Friday, 27 January 2012" into the Date format.
simpleDateFormat Problems and questions
How to use DateFormat
developer file tools