DateFormat myformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String date = myformat.format(new java.util.Date()); System.out.println(date);