SimpleDateFormat time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

String TimeString = time.format(new java.util.Date());

System.out.println(TimeString);