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
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
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Beginning Java
Convert String value to Date Object
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
I like...
posted 14 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: 22783
131
I like...
posted 14 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 14 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 14 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: 22783
131
I like...
posted 14 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
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...