For example, I have a time string in the form "00:30:00", so the output should be 30 minutes. Or if we have "15:00:30", so the output should be 15 hours 30 seconds. Can it be done using moment? or do I need to write my own code?
Asked
Active
Viewed 4,448 times
-2
-
2If question is just about *Can it be done using moment?* **Yes.** – Rajesh Nov 16 '16 at 12:25
-
No it's not just about that. I want to know how? – onezero Nov 16 '16 at 12:39
-
@timster ... I haven't tried anything yet. I think the question is pretty clear though. Moment helps to convert datetime formats and I want to convert this "hh:mm:ss" into this "hh hours mm minutes ss seconds". – onezero Nov 16 '16 at 12:45
-
1@AyushGoswami, just trying to help you understand what is expected of a question here on SO. (It's more than you've provided.) http://stackoverflow.com/help/how-to-ask – Tim Grant Nov 16 '16 at 12:48
-
1Possible duplicate of [How can I humanize this complete duration in moment.js / javascript](http://stackoverflow.com/questions/14157341/how-can-i-humanize-this-complete-duration-in-moment-js-javascript) – Tim Grant Nov 16 '16 at 13:23
1 Answers
0
Here is a post that can help you: https://stackoverflow.com/a/21840646/4573534
All you need to do now is to parse hh:mm:ss
to milliseconds

Community
- 1
- 1

Oren Haliva
- 351
- 3
- 14