【发布时间】:2015-07-09 06:22:53
【问题描述】:
我在我的应用程序中使用引导日期时间选择器。我使用像“yyyy-mm-dd hh:ii:ss”这样的格式,结果像“2015-07-09 12:25:12”,但我想设置“:00”代替秒,这样我的新日期格式变成了“2015-07-09 12:25:00”。我尝试了下面的代码,但缺少秒字段。它显示为“2015-07-09 12:25”。
directives.directive('tgdatetimepicker', function() {
return {
restrict: 'A',
require : '?ngModel',
link: function(scope, element, attrs, ngModelCtrl) {
element.datetimepicker({
format: "mm-dd-yyyy hh:ii:00",
autoclose: true,
todayBtn: true,
pickerPosition: "bottom-left"
}).on('setDate', function(e) {
ngModelCtrl.$setViewValue(e.date);
scope.$apply();
});
}
};
});
【问题讨论】: