I use AngularJs. In a controller I get time. Then I want to show it in view with 2 textview. The first is dd:mm:yy the second is hh:mm:ss but when I use {{transaction.transactionTime|date:'h:mm:ss a'}} it return wrong result. How can I get time without date.
-
2Please show us the code, and the output, and what you expectStudioTime– StudioTime2015-04-17 08:05:05 +00:00Commented Apr 17, 2015 at 8:05
-
1possible duplicate of Format Date time in Angular JSCodingIntrigue– CodingIntrigue2015-04-17 08:06:37 +00:00Commented Apr 17, 2015 at 8:06
-
1use moments.js and you can create you own filter for that if you need example for that please let me know. Hope this may help. LINK: momentjs.comNeeraj Verma– Neeraj Verma2015-04-17 08:10:29 +00:00Commented Apr 17, 2015 at 8:10
-
what is your expected time-date format?Ataur Rahim Chowdhury– Ataur Rahim Chowdhury2015-04-17 08:14:52 +00:00Commented Apr 17, 2015 at 8:14
Add a comment
|
1 Answer
The documentation for this is actually pretty good on the angular site:
HTML
{{ date_expression | date : 'short'}}<br/>
{{ date_expression | date : 'fullDate'}}<br/>
{{ date_expression | date : 'longDate'}}<br/>
{{ date_expression | date : 'mediumDate'}}<br/>
{{ date_expression | date : 'shortDate'}}<br/>
{{ date_expression | date : 'mediumTime'}}<br/>
{{ date_expression | date : 'shortTime'}}<br/>
Controller
$scope.date_expression = new Date();
You can see the Plunkr Demo
I believe date:'h:mm:ss a' would be what the documentation calls 'mediumTime'