-2

I have a string like this: 2014-08-20T00:00:00 is possible to convert in a Date (not a string) like this: 20/08/2014 (must be a java.util.Date not a String)

Is possible?

user1066183
  • 2,244
  • 4
  • 25
  • 54
  • 2
    you can use SimpleDateFormat. http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html – Adi Aug 12 '14 at 11:05
  • possible duplicate of [Convert string to date then format the date](http://stackoverflow.com/questions/7882025/convert-string-to-date-then-format-the-date) – Raedwald Aug 12 '14 at 12:08

1 Answers1

2

Use SimpleDateFormat for this:

String s ="2014-08-20T00:00:00"; 
DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
System.out.println(df.parseObject(s));
Jens
  • 63,364
  • 15
  • 92
  • 104