date format to specific format javascr code example
Example 1: 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));
Example 2: javascript date parse yyyy-mm-dd
var dateString = "10/23/2015";
var dateObject = new Date(dateString);
document.body.innerHTML = dateObject.toString();