If you’re using moment.js you can simply call…
moment.duration('PT15M33S').asMilliseconds();
= 933000 ms
EDIT 2021: While this works, and still gets upvotes, I wouldn’t advise including moment.js just for this. I’d recommend using a regex answer like @redgetan’s
More Related Contents:
- Function to convert timestamp to human date in javascript [duplicate]
- How to find out the exact number of followers on YouTube?
- How to decide when to use Node.js?
- How do I convert an existing callback API to promises?
- Correct way to write a non-blocking function in Node.js
- Call async/await functions in parallel
- How to append to a file in Node?
- How to properly reuse connection to Mongodb across NodeJs application and modules
- How to chain and share prior results with Promises [duplicate]
- return value after a promise [duplicate]
- async for loop in node.js
- Are there still reasons to use promise libraries like Q or BlueBird now that we have ES6 promises? [closed]
- Running NPM scripts sequentially
- Gulp.js task, return on src?
- Uncaught TypeError: Object.values is not a function JavaScript
- How is Node.js inherently faster when it still relies on Threads internally?
- Renaming files using node.js
- How to close electron app via javascript?
- Difference between import X and import * as X in node.js (ES6 / Babel)?
- Node.js console.log – Is it possible to update a line rather than create a new line?
- How do I use .toLocaleTimeString() without displaying seconds?
- ES2015 “import” not working in node v6.0.0 with with –harmony_modules option
- Failed to load resource from same directory when redirecting Javascript
- What does “this” mean in a nodejs module?
- JavaScript dependency management: npm vs. bower vs. volo [closed]
- ES6 import from root
- Property ‘XXX’ does not exist on type ‘CombinedVueInstance’
- How to assign a domain name to node.js server? [duplicate]
- Manage multiple tabs (but same user) in socket.io
- ESLint: “error Parsing error: The keyword ‘const’ is reserved”