how to get current date in long format in javascript long date code example

Example 1: javascript format date yyyy-mm-dd

let today = new Date()
today.toISOString().split('T')[0]

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")); // 9/17/2016
console.log(today.toLocaleDateString("en-US", options)); // Saturday, September 17, 2016
console.log(today.toLocaleDateString("hi-IN", options));

Tags:

Php Example