Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Beginning Java
Search Coderanch
Advance search
Google search
Register / Login
Win a copy of
A Functional Approach to Java: Augmenting Object-Oriented Java Code with Functional Principles
this week in the
Functional programming
forum!
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Liutauras Vilda
Ron McLeod
Jeanne Boyarsky
Paul Clapham
Sheriffs:
Junilu Lacar
Tim Cooke
Saloon Keepers:
Carey Brown
Stephan van Hulst
Tim Holloway
Peter Rooke
Himai Minh
Bartenders:
Piet Souris
Mikalai Zaikin
Forum:
Beginning Java
Convert String value to Date Object
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
I like...
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
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
Posts: 22743
129
I like...
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Then you haven't used the right
pattern
. Which one did you use?
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions
How To Answer Questions
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
I like...
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Sorry for the late reply
this is my code:
String str = "Wed Oct 15 00:00:00 GMT+05:30 2008"; SimpleDateFormat sdf = new SimpleDateFormat("EEE, MMM dd HH:mm:ss yyyy z"); //sdf.applyPattern("EEE, MMM dd HH:mm:ss yyyy z"); Date dt = sdf.parse(str); System.out.println(dt);
the Exception is : java.text.ParseException: Unparseable date: "Wed Oct 15 00:00:00 GMT+05:30 2008"
thanks
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
I like...
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Ahh , sily mistake! [Problem Solved]
this is right pattern.
SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy");
thanks Rob
Rob Spoor
Sheriff
Posts: 22743
129
I like...
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
You're welcome. I know that sometimes you can find solutions yourself just by sharing the problem.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions
How To Answer Questions
Evildoers! Eat my justice! And this tiny ad's justice too!
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Date Format
Formatting the String
Help in converting date from string
convert a string to date whitout format
convert date format
More...