本文介绍了如何格式化angularjs日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要格式化日期 MM / DD / YYYY 。我尝试以下,没有它为我工作。谁能帮我这个?
参考: UI最新
<输入UI更新UI的日期格式=MM / DD / YYYYNG-模式=valueofdate/><输入类型=日期NG模型=valueofdate/>解决方案
Angular.js有一个内置的日期过滤器。
演示
//在你的控制器:$ scope.date ='20140313T00:00:00';//在你看来,date属性,与日期过滤器和过滤格式MM / DD / YYYY< p NG绑定=日期|日期:'MM / DD / YYYY'>< / P>//产生2014年3月13日您可以看到支持的日期格式in源的日期过滤器。
的修改的:
如果你想(如果你使用的日期选择器,或只是想使用它的格式不清晰),以获得在日期选择正确的格式,这些支持的格式字符串在这里:的api.jqueryui/datepicker/
I want to format date as mm/dd/yyyy. I tried the following and none of it works for me. Can anyone help me with this?
reference: ui-date
<input ui-date ui-date-format="mm/dd/yyyy" ng-model="valueofdate" /> <input type="date" ng-model="valueofdate" />解决方案
Angular.js has a built-in date filter.
demo
// in your controller: $scope.date = '20140313T00:00:00'; // in your view, date property, filtered with date filter and format 'MM/dd/yyyy' <p ng-bind="date | date:'MM/dd/yyyy'"></p> // produces 03/13/2014You can see the supported date formats in the source for the date filter.
edit:
If you're trying to get the correct format in the datepicker (not clear if you're using datepicker or just trying to use it's formatter), those supported format strings are here: api.jqueryui/datepicker/
更多推荐
如何格式化angularjs日期
发布评论