calendar to string code example
Example 1: java calendar class format
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
Date date = new Date();
System.out.println(dateFormat.format(date)); //2013/10/15 16:16:39
Example 2: Convert a date to yyyy mm dd format
const formatYmd = date => date.toISOString().slice(0, 10);
formatYmd(new Date());