I have a string in the format of something like this: “7:18 am”
What I’d like to be able to do is extract the “718” (not the colon in between) and the “am” into two separate variables.
I tried doing something like this, but it only returned the first integer – in this case, the 7.
var time = parseInt("7:18")
What would be the best way to accomplish this?
1 Answer