代码
@Test
public void test(){
DateTime dateTime = new DateTime();
String str = dateTime.toString("yyyy-MM-dd HH:mm:ss");
System.out.println(str);
Date date = new Date();
dateTime = new DateTime(date);
str = dateTime.toString("yyyy-MM-dd HH:mm:ss");
System.out.println(str);
}
2017-11-12 15:42:04
2017-11-12 15:42:04
参考博客