Date date = new Date(); System.out.println(date.toString()); } } radio_button_unchecked Converted String Date and TIme Format code example
Example 1: date to string java
Date date = Calendar.getInstance().getTime();
DateFormat dateFormat = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss");
String strDate = dateFormat.format(date);
Example 2: java date to string
Format formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String s = formatter.format(date);