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:

Example for Conditional Operator in php

16-04-2017 php Conditional Operator example

How to upload file by using request module

18-03-2017 request module node js

Using slice remove last two characters from given string

07-03-2017 slice remove

Filters for convert text to camel case in Angular Js

05-03-2017 angularjs camelcase filters

Call a function every second or 5 seconds in javascript

22-02-2017 setinterval function calling