Filter for change Date format (MM-dd-yyyy) in Angular Js

mm-dd-yyyy
date formats
angular js

By using below filter for change Date format (MM-dd-yyyy) in Angular Js, for given date.
Ex : 2017-03-05 08:40:00. By using the below filter the final result is 03-05-2017

angular.module('test').
filter('ChangeDateFormat', function($filter)
{
	return function(input)
	{
		if(input == null){ return ""; }
		var _date = $filter('date')(new Date(input), 'MM-dd-yyyy');
		return _date;
	};
});

 

 

You might also like:

Check null values in JavaScript?

04-02-2019 JavaScript null check null value

File Upload Using Angular Js and Node Js

28-05-2018 AngularJs Node js file upload multer module

How to get current date and time (yyyy-mm-dd H:i:s) using javascript

09-03-2017 javascript date time

How to find Angular Errors

06-03-2017 errors angularjs exceptionHandler

Filters for convert text to camel case in Angular Js

05-03-2017 angularjs camelcase filters