Angular2-Moment, Format Minutes To

These are minutes : 1956

I want to format these minutes to : HH:mm

I'm using angular2-moment.

I've tried : 1956 | amDuration:'minutes' | amDateFormat: 'HH:mm'

But I get "Invalid date"

What do i have to do to make it work ?

5

2 Answers

moment.duration(1956, "minutes").format("h [hrs], m [min]");
// "32 hrs, 36 min"
2
countdown = 600;

{{ (countdown | amFromUnix) | amDateFormat: 'mm:ss' }}

//Output 10:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Elena Rostova

Elena Rostova

Lead Health, Wellness & Medical Journalist

Elena Rostova holds a Master's degree in Public Health Journalism. She covers groundbreaking medical research, holistic wellness trends, mental health awareness, and nutritional science.

Share this article
Twitter Facebook Pinterest