0

I have a variable in which I stored a date retrieved from the server. It looks something like this:

"draw_start_at": "2015-09-04T08:54:09.574Z"

I would like to just extract hours and minutes from here.

2
  • And what have you try so far ? What is your problem ? Commented Sep 4, 2015 at 11:54
  • {{currentdate | date}} and {{currentdate | 'hh:mm'}}, no changes. Commented Sep 4, 2015 at 11:58

2 Answers 2

1

LimitTo

Using limitToyou can take your full string and just display some characters from it. Take a look at the full documentation here

HTML

{{ limitTo_expression | limitTo : limit : begin}}

JS

$filter('limitTo')(input, limit, begin)

Conclusion

This lets you specify a begining and end for the characters you wish to display, you can cut out all of the other things around and just be left with the hours.

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

1 Comment

Useful approach. Worked!
0
{{draw_start_at | date: 'hh:mm'}}

2 Comments

of course that's the obvious solution. Problem is, it doesn't seem to work for some reason.
it works in my project. why don't you show more of your code?

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.