If you want to format date in AngularJS? Angular.js has a built-in date filter to format the date. See the below example:
1 2 3 4 5 | var app = angular.module('plunker', []); app.controller('MainCtrl', function($scope) { $scope.date = '20140313T00:00:00'; }); |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | <!DOCTYPE html> <html ng-app="plunker"> <head> <meta charset="utf-8" /> <title>AngularJS Plunker</title> <script>document.write('<base href="' + document.location + '" />');</script> <link rel="stylesheet" href="style.css" /> <script data-require="[email protected]" src="http://code.angularjs.org/1.2.14/angular.js" data-semver="1.2.14"></script> <script src="app.js"></script> </head> <body ng-controller="MainCtrl"> <p ng-bind="date | date:'MM/dd/yyyy'"></p> </body> </html> |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.