New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
h:mm:ss to seconds and vice versa #704
Comments
This is being added with this pull request. #702 moment.duration("5:45:15").asSeconds(); In the meantime, I suppose you could use something like this as a workaround. var a = moment.utc('5:45:15', 'H:mm:ss'),
b = a.clone().startOf('day');
return a.diff(b, 'seconds'); |
and the other way around? second to h:mm:ss? |
d = moment.duration({s: 1000});
moment().startOf('day').add(d).format('HH:mm:ss') that won't work for more than 24 hours though. |
So momentjs as it is, is not quite the right tool for this kind of stuff.. |
Well, as @timrwood said there is a patch comming that would enable one of the conversions. About the other way around -- there is a way to humanize a duration, but it won't be in a specific format. There was some discussion (#463) about controlling the formatting of humanize, but nothing implemented yet. If you have a specific proposal for an api I'll be glad to hear it. |
What would be nice is you said here #704 (comment) only if you could call |
This sounds like a feature request. Can you form it as such and specify format tokens/semantics. |
Closing this in favor of #1048. |
Is there any way to get seconds from say 5:45:15?
The text was updated successfully, but these errors were encountered: