aspose file tools*
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
JavaRanch » Java Forums » Java » Java in General
Bookmark "String to Java Date" Watch "String to Java Date" New topic
Author

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?
Thanks,
Drew
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...
Drew
 
Don't get me started about those stupid light bulbs.
 
subject: String to Java Date