How to change date format using date filter in AngularJS?
In this post we will give you information about How to change date format using date filter in AngularJS?. Hear we will give you detail about How to change date format using date filter in AngularJS?And how to use it also give you demo for it if it is necessary.
AngularJS provides several filter for developing. AngularJS date filter through you can change date format as you want like yyyy-mm-dd, dd-MM-yyyy, MM-dd-yyyy etc. In bellow example you could understand very well date helper to how to use date filter in Angular JS.
In this example i have one array with date(yyyy-mm-dd date format) and date format will be convert into dd-mm-yyyy using date filter.
Example
<html lang="en-US">
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<body>
<div ng-app="myApp" ng-controller="customersCtrl">
<table>
<tr>
<th>Language</th>
<th>Date</th>
</tr>
<tr ng-repeat="x in names">
<td>{{ x.language }}</td>
<td>{{ x.date | date: 'dd-MM-yyyy' }}</td>
</tr>
</table>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('customersCtrl', function($scope, $http) {
$scope.names = [
{'language': 'PHP', 'date': '2016-06-01' },
{'language': 'Laravel', 'date': '2016-06-02'},
{'language': 'Angular JS', 'date': '2016-06-05'},
];
});
</script>
</body>
</html>
Hope this code and post will helped you for implement How to change date format using date filter in AngularJS?. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs