Check out example codes for "date to string java". It will help you in understanding the concepts better.

Code Example 1

Date date = Calendar.getInstance().getTime();  
    DateFormat dateFormat = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss");  
    String strDate = dateFormat.format(date);

Code Example 2

Format formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String s = formatter.format(date);

Learn ReactJs, React Native from akashmittal.com