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:
Compare the Triplets | Javascript | hackerrank.com07-05-2020 hackerrank.com |
File Upload Using Angular Js and Node Js28-05-2018 AngularJs Node js file upload multer module |
How to redirect one page to another page in php20-03-2017 redirect php |
Remove last two characters from given string06-03-2017 substring javascript remove |
Get Unique values from array/object in javascript19-02-2017 javascript unique remove repeated values from array |