Tuesday, June 30, 2015

AngularJS date Filter

AngularJS filters are used to format/transform the data displayed in the view, filters can be used with expressions, ng-bind, ng-repeat etc and act upon the data from the model. The date filter is used to format date values.

The following is the syntax for using date filters
{{ <date variable> | date: '<date format>' }}

The following is an example of using date filters.
<html ng-app>
<head>
    <meta charset="utf-8" />
    <title>AngularJS - Basic</title>
    <script src="angular.min.js"></script>
</head>
<body>
          <div ng-init="disp_date=460046671914">
                   <p>Output :<b> {{ disp_date | date: 'MM/dd/yyyy' }} </b></p>
          </div>
</body>
</html>

Output:


Search Flipkart Products:
Flipkart.com

No comments: