[TOC]
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date now = new Date();
System.out.println(sdf.format(now));//2018-02-14 13:22:12public static void main(String[] args) throws ParseException {
String d = "2014-6-1 21:05:36";
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = sdf.parse(d);
System.out.println(date);//Sun Jun 01 21:05:36 CST 2014
}