Filter for change Date 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:

Time Sorting Ascending or Descending Order in Javascript
19-07-2017 Javascript ascending order descending order
Get next date from given date in javascript
06-03-2017 date javascript next date
Change datepicker display format
06-03-2017 datepicker angular js
Filter for insert HTML in Angular Js
06-03-2017 filter show html angular js html
Call a function every second or 5 seconds in javascript
22-02-2017 setinterval function calling