Filter for change Date Time format (MM-dd-yyyy HH:mm) in Angular Js

05-03-2017 mm-dd-yyyy HH:MM date formats angular js

Angular.js has a built-in date filter. But as per our requirements we can use filers to change date formats 

angular.module('surgi').
filter('ChangeTimeFormat', function($filter)
{
	return function(input)
	{
		if(input == null){ return ""; }
		var _date = $filter('date')(new Date(input), 'HH:mm');
		return _date;
	};
});

This filter load in your js file. This filter calls from html. Here is the sample code to call the filter

<p>{{dt | ChangeTimeFormat}}<p>

 

 

 

 

You might also like:

Convert Time 24 hrs to 12 hrs format In javascript
12-03-2017 date javascript 12hrs convert
Navigate to another page using java script
06-03-2017 javascript redirection navigation
Change datepicker display format
06-03-2017 datepicker angular js
How to change background color and color to the text using javascript
27-02-2017 css javascript colors
How to set or update or push the values into Object in javacript
27-02-2017 javascript set update push object