you can convert it into string using toString and then get the required substring.
2010/10/4 Nguyễn Đình Đoàn <[email protected]> > 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]<javaprogrammingwithpassion%[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
