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:

Convert and download html to pdf without saving file

28-10-2018 node js convert html to pdf pdf download pdf without saving

How to submit form using javascript or jquery.

16-04-2017 javascript jquery submit form

How to remove last / value from url in javascript

27-02-2017 array javascript last value

Sample Validations in javascript

22-02-2017 validations javascript

Send Mail in Node Js

21-02-2017 node js mail npm module