1 Date date = Calendar.getInstance().getTime();
2 DateFormat dateFormat = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss");
3 String strDate = dateFormat.format(date);
1Format formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
2String s = formatter.format(date);
1SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
2try {
3 Date date = new Date();
4 String dateTime = dateFormat.format(date);
5 System.out.println("Current Date Time : " + dateTime);
6} catch (ParseException e) {
7 e.printStackTrace();
8}
9