This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach 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 Murach's Java Servlets and JSP this week in the Servlets forum!
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: String to Java Date
 
Similar Threads
date format
first date and last date of month
Having trouble using Dates in SQL
date format
Hibernate Date mapping