Converting Youtube Data API V3 video duration format to seconds in JavaScript/Node.js
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