如何将文本转换为日期格式?

时间:2018-11-01 07:08:40

标签: javascript angularjs

我进行了一个演示,其中我在文本字段中显示值。我想以某种格式转换日期字段。我在Google上进行了搜索,发现其中存在库“ moment js”。目前,我在“ 1989年2月2日”中显示日期,现在我想将其转换为12-Feb-1989。我可以使用js时刻

进行操作吗?

https://github.com/urish/angular-moment

这是我的代码 http://plnkr.co/edit/S1IegfwTOUJ0YvaB5mud?p=preview

var app = angular.module('plunker', ['angularMoment']);

app.controller('MainCtrl', function($scope ,moment) {
  $scope.name = 'World';
  console.log(moment)
  $scope.c = {
   ab: {
      name:'abc'
    },
   date: {
      name:'12-02-1989'
    }
    };

    $scope.onclick =function(){
        console.log($scope.c)
    }

});

0 个答案:

没有答案
相关问题