This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 19656
    
  18

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: 19656
    
  18

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
 
Similar Threads
Help in converting date from string
convert date format
Date Format
convert a string to date whitout format
Formatting the String