date to string methods js list reference quick example
Example 1: how to print date like 10-may-2018 in javascript
date.toString('YYYY-MM-dd'); 'Tue Feb 10 2015 15:42:50'
var date = new Date('4-1-2015');
date.getDay();
date.getYear();
date.getFullYear();
date.getMonth();
date.getUTCDate();
Example 2: javascript format date
var options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
var today = new Date();
console.log(today.toLocaleDateString("en-US"));
console.log(today.toLocaleDateString("en-US", options));
console.log(today.toLocaleDateString("hi-IN", options));