I think pattern has to be
EEE MMM dd HH:mm:ss z yyyy
As "h" letter represents hour in am/pm(1-12)
Sent from iPhone
On Oct 4, 2010, at 1:41 PM, Nguyễn Đình Đoàn
<[email protected]> wrote:
Hi friends,
When I run command: System.out.println(new Date());
It printed out: Tue Oct 05 00:32:53 ICT 2010
So, If I have a String as "Tue Oct 05 00:32:53 ICT 2010"
How to convert it to Date (java.util.Date)
I tried running:
DateFormat f = new SimpleDateFormat("EEE MMM dd hh:mm:ss z yyyy");
System.out.println("New Date: " + f.parse("Tue Oct 05 00:26:28 ICT
2010"));
But got error:
Exception in thread "main" java.text.ParseException: Unparseable
date: "Tue Oct 05 00:26:28 ICT 2010"
Thanks !
Doan Nguyen Dinh
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/javaprogrammingwithpassion?hl=en