-3

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.

4
  • 2
    Please show us the code, and the output, and what you expect Commented Apr 17, 2015 at 8:05
  • 1
    possible duplicate of Format Date time in Angular JS Commented Apr 17, 2015 at 8:06
  • 1
    use 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.com Commented Apr 17, 2015 at 8:10
  • what is your expected time-date format? Commented Apr 17, 2015 at 8:14

1 Answer 1

1

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'

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.