AngularJS Tutorial - Padded month in year Date Filter








The following code shows how to use 'Padded month in year' Date Filter.

Example


<!--from  w  ww.ja v a2 s. c  om-->
<!doctype html>
<html ng-app="myApp">
<head>
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0-rc.2/angular.js"></script>
</head>
<body>
  <div ng-controller="myController">
    <div>Padded month in year: {{ today | date:'MM' }}</div>
  </div>
  <script>
    angular.module('myApp', [])
    .controller('myController', function($scope, $filter) {
      $scope.today = new Date();
    })
  </script>

</body>
</html>

The code above is rendered as follows: