aspose file tools*
The moose likes Beginning Java and the fly likes Convert String value to Date Object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Convert String value to Date Object" Watch "Convert String value to Date Object" New topic
Author

Convert String value to Date Object

Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Hi Folks,

How to convert a String "Wed Oct 15 00:00:00 GMT+05:30 2008" to Date [by using format or any other way ] ?. i tried using SimpleDateFormat but failed
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19718
    
  20

Then you haven't used the right pattern. Which one did you use?


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Sorry for the late reply

this is my code:



the Exception is : java.text.ParseException: Unparseable date: "Wed Oct 15 00:00:00 GMT+05:30 2008"

thanks
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Ahh , sily mistake! [Problem Solved]

this is right pattern.



thanks Rob
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19718
    
  20

You're welcome. I know that sometimes you can find solutions yourself just by sharing the problem.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Convert String value to Date Object