How can I convert a java.util.Date
to String
using
DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern(\"yyyy-MM-dd\'T\'H
since I asume you are using joda API: ergo, DateTimeFormatter is comming from org.joda.time.format.DateTimeFormatter:
String dateTime = "02-13-2017 18:20:30";
// Format for input
DateTimeFormatter dtf = DateTimeFormat.forPattern("MM-dd-yyyy HH:mm:ss");
// Parsing the date
DateTime jodatime = dtf.parseDateTime(dateTime);
System.out.println(jodatime );