AngularJS Tutorial - Date value filter








The following code shows how to use date value filter.

Example


<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js"></script>
<script type='text/javascript'>
function MyCtrl($scope) {<!--  w  w w . jav a  2 s . c  o  m-->
    $scope.date = new Date();
}
</script>
</head>
<body>
  <div ng-app ng-controller="MyCtrl">
    {{date | date:'dd MMM yyyy - hh:mm a'}}<br />
    {{date | date:'EEEE - hh:mm '}}<br />
    {{date}}    
</div>
</body>
</html>

The code above is rendered as follows: