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

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:

Functions in javascript

25-05-2018 functions javascript es5 es6 arrow functions named functions Closures Nested Functions Callbacks Arrow functions.

How to search text in string using php ?

29-10-2017 php search string search

How to find Angular Errors

06-03-2017 errors angularjs exceptionHandler

Call a function every second or 5 seconds in javascript

22-02-2017 setinterval function calling

Send Mail in Node Js

21-02-2017 node js mail npm module