Reputation: 767
I have a scenario in which I have to set a date for event, the date picker should take the date format in localized format according to country or region. How can I do that in AngularJS? I have tried many solutions but didn't find any appropriate one.
Upvotes: 1
Views: 150
Reputation: 7591
You can use toLocaleDateString()
Reference
var today = new Date();
var date = new Date(Date.UTC(2012, 11, 20, 3, 0, 0));
console.log(date.toLocaleDateString('en-US'));
console.log(today.toLocaleDateString('en-US'));
Upvotes: 0