Reputation: 215
How do I convert date from mm-dd-yyyy to mm/dd/yyyy in AngularJS. Here is the plunker http://plnkr.co/edit/uoeuuHD8GOkPxj5LOlE5?p=preview
$scope.date = '07-28-2016';
{{ data | date:'filter'}} //should return 07/28/2016
Upvotes: 0
Views: 334
Reputation: 165065
First, start with an actual Date
instance
$scope.date = new Date('2016-07-28'); // ISO 8601 date formats are less ambiguous
then use the date
filter, ie
{{ date | date: 'MM/dd/yyyy' }}
http://plnkr.co/edit/ay2DDwzxQTiBx34bEO5d?p=preview
Upvotes: 2