how to get weekday in number from date in angularJS binding -
i want "day of week" specific date in angular binding. expected result like:
date=07/26/2017 above date day "wednesday" expected result "3" b'coz above date weekday "3"
you can try this:
var t = new date('07/26/2017') t.getday() // return 3
this working snippet:
var app = angular.module("myapp", []); app.controller("myctrl", function($scope) { $scope.mydate = '07/26/2017'; }); app.filter('customdate', function() { return function(input) { var t = new date(input); return t.getday(); } });
<!doctype html> <html> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script> <body> <div ng-app="myapp" ng-controller="myctrl"> {{mydate|customdate}} </div>
Comments
Post a Comment