This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Java in General and the fly likes String to Java Date Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "String to Java Date" Watch "String to Java Date" New topic

String to Java Date

Drew Lane
Ranch Hand

Joined: May 13, 2001
Posts: 296
I have a string that is in a date format: 08/13/02
How would I convert this to a Java date object so that I can use Java Methods to manipulate the date?
john guthrie
Ranch Hand

Joined: Aug 05, 2002
Posts: 124
see java.text.DateFormat, specifically something like:
DateFormat parser = DateFormat.getDateInstance(DateFormat.SHORT);
Date d = parser.parse("12/22/97");
Drew Lane
Ranch Hand

Joined: May 13, 2001
Posts: 296
Thanks, I'll give that a try.
I didn't know DateFormat could parse, too.
So much to learn, so little time...
I agree. Here's the link:
subject: String to Java Date
It's not a secret anymore!