aspose file tools*
The moose likes Java in General and the fly likes converting string to date Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "converting string to date" Watch "converting string to date" New topic
Author

converting string to date

pratik doshi
Greenhorn

Joined: Jul 22, 2010
Posts: 6
for eg:i have a string"02/11/2004"
i want to convert it to date in the same above format
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61420
    
  67

Hint: look in the java.text package.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14269
    
  21

Date objects do not have a format. You can parse a String to a Date object using a SimpleDateFormat object, but the Date object itself doesn't have a format.

If you want to display the Date later, you just have to format it again (using a SimpleDateFormat object). You specify the format in the SimpleDateFormat object, not the Date object itself.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: converting string to date