For normal date Strings like \"2019-04-08 08:35\"
SimpleDateFormat df = new SimpleDateFormat(\"yyyy-dd-mm hh:mm\");
but What sh
SimpleDateFormat
is not a Date
, it's used to
You can parse String to java.time.LocalDateTime
directly since java8:
LocalDateTime localDateTime = LocalDateTime.parse("2019-04-21T12:08:35");
System.out.println(localDateTime);
Before Java8 :
SimpleDateFormat df = new SimpleDateFormat("yyyy-dd-yy'T'hh:mm:ss");