如何在 AngularJS 中仅显示日期时间?
How to show only time of date in AngularJS?
大家好 如何在angular js中只显示时间值?
我已经使用 ng-repeat
获取了时间值,我只想在我的门户中显示时间值。
我试图获取像 <p>3. TIME</p><span><h4>{{user.time | date:'medium'}}</h4></span>
这样的时间值
例如:- 我只想显示时间 10:00:00 PM
而不是 Jan 1, 1970 10:00:00 PM
如何做到这一点请帮助我们谢谢。
我的Html:-
<div ng-repeat="user in users">
<p>1. Name</p><span><h4>{{user.title}}</h4></span>
<p>2. Day</p><span><h4>{{user.day}}</h4></span>
<p>3. TIME</p><span><h4>{{user.time | date:'medium'}}</h4></span>
</div>
我的数据:-
$scope.users = [
{
"_id": "5a33880dd725a05813014c22",
"user": {
"_id": "59df6a76b6748bc809050697",
"displayName": "Maniselvam selvam",
"dob": "1991-05-10T07:00:00.000Z",
"profileImageURL": "./modules/users/client/img/ownprofile/uploads/a7d398db972da9dcb1c90480353d00c0"
},
"__v": 2,
"openeyers": [],
"time": "1970-01-01T16:30:00.000Z",
"day": "Wednesday",
"registration_number": "Test3",
"title": "Mercy",
"created": "2017-12-15T08:30:05.357Z",
"isCurrentUserOwner": true
}
]
而不是
{{user.time | date:'medium'}}
使用
{{user.time | date:'mediumTime'}}
'mediumTime': equivalent to 'h:mm:ss a' for en_US locale (e.g. 12:05:08 PM)
大家好 如何在angular js中只显示时间值?
我已经使用
ng-repeat
获取了时间值,我只想在我的门户中显示时间值。我试图获取像
<p>3. TIME</p><span><h4>{{user.time | date:'medium'}}</h4></span>
这样的时间值
例如:- 我只想显示时间
10:00:00 PM
而不是 如何做到这一点请帮助我们谢谢。
Jan 1, 1970 10:00:00 PM
我的Html:-
<div ng-repeat="user in users">
<p>1. Name</p><span><h4>{{user.title}}</h4></span>
<p>2. Day</p><span><h4>{{user.day}}</h4></span>
<p>3. TIME</p><span><h4>{{user.time | date:'medium'}}</h4></span>
</div>
我的数据:-
$scope.users = [
{
"_id": "5a33880dd725a05813014c22",
"user": {
"_id": "59df6a76b6748bc809050697",
"displayName": "Maniselvam selvam",
"dob": "1991-05-10T07:00:00.000Z",
"profileImageURL": "./modules/users/client/img/ownprofile/uploads/a7d398db972da9dcb1c90480353d00c0"
},
"__v": 2,
"openeyers": [],
"time": "1970-01-01T16:30:00.000Z",
"day": "Wednesday",
"registration_number": "Test3",
"title": "Mercy",
"created": "2017-12-15T08:30:05.357Z",
"isCurrentUserOwner": true
}
]
而不是
{{user.time | date:'medium'}}
使用
{{user.time | date:'mediumTime'}}
'mediumTime': equivalent to 'h:mm:ss a' for en_US locale (e.g. 12:05:08 PM)