RI Khan RI Khan - 1 year ago 145
AngularJS Question

AngularJs Convert string datetime to datetime object

I need to convert "10-28-2016 10:27:14 AM" string datetime to datetime Fri Oct 28 2016 12:04:16 in angularJs
Pls Help

Answer Source


<p>{{'10-28-2016 10:27:14 AM' | filter}}</p>

filter and controller

        $rootScope.title = 'myTest Page';
    .controller('testController', ['$scope', function($scope){

    }]).filter('filter', function($filter) {

return function(input) {

var date = new Date(input);
return($filter('date')(date, 'EEE MMM dd yyyy HH:mm:ss') );
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download