AngularJS Tutorial - '4 digit representation of timezone offset' Date Filter








The following code shows how to use '4 digit representation of timezone offset' Date Filter.

Example


<!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><!--from w w w.  j ava 2 s  .  co m-->
<body>
  <div ng-controller="myController">
    <div>4 digit representation of timezone offset: {{ today | date:'Z' }} </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: