angularjs - Is there any way to fetch only date from new date() function without time -
suppose 1 value have mon jul 04 2016 18:12:03 gmt+0530 (india standard time) , want result jul-04-2016. how can in angular js.
here's snippet working:
var app = angular.module('app', []); app.controller('mainctrl', function ($scope) { $scope.data = new date(); });
<!doctype html> <html ng-app="app"> <head> <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.7/angular.min.js"></script> </head> <body ng-controller="mainctrl"> date without format: <span ng-bind="data"></span> <hr/ > date format ("mmm-dd-y"): <span ng-bind="data | date: 'mmm-dd-y'"></span> </body> </html>
you can check formats provided date api here.
Comments
Post a Comment