This question already has answers that address the problem in the question, which contains the simplification that minutes and seconds are always included. People may land here with the similar, but more general problem that only the needed time components are included, so any one or more of the components may be missing.
Ron Rosenfeld's great answer already handles that. For readers not familiar with VBA or regex, who might prefer a formula-based solution they can more readily adapt and maintain, the other current answers don't handle the general case. I'll post this formula-based solution as a separate answer because it's more complicated than required for the limited case in this question, and combining it with my other answer would make both solutions less accessible.
![enter image description here](https://cdn.statically.io/img/i.sstatic.net/vsMyD.png)
This solution also uses some helper columns to avoid formula repetition, but takes a little different approach. Columns B through D each look for the different time component letters. The formulas in the first row:
B1: =FIND("h",A1)
C1: =FIND("m",A1)
D1: =FIND("s",A1)
If the letter is present this return the position of that letter in the original string, otherwise an error. The "s", if present, will always be the last character, but finding its character position simplifies extracting the seconds value, and FIND serves the double purpose of identifying whether it is present.
Column E extracts each time component value, multiplies it by the conversion factor for seconds, and adds them up. It uses MID to extract the values based on the marker locations found in columns B through D.
The complexity is that for minutes and seconds, some or all of the preceding time components may not be present; the formula needs to determine where in the string the current component starts based on which of the preceding components are present. The formula in E1 is:
=3600*IFERROR(LEFT(A1,B1-1),0)+
60*IFERROR(MID(A1,1+IFERROR(B1,0),C1-1-IFERROR(B1,0)),0)+
IFERROR(MID(A1,1+MAX(IFERROR(B1,0),IFERROR(C1,0)),D1-1-MAX(IFERROR(B1,0),IFERROR(C1,0))),0)
I've added line breaks to the formula between the time components for readability, so remove them to copy and paste the formula.
Hours is pretty simple. It takes the characters on the left prior to the "h", or zero if "h" was missing, and multiplies it by 3600.
The minutes value can only be preceded by hours. If a minutes value is present, it calculates the start point and length for MID based on whether there is an hours component.
The location of the seconds value, if present, depends on the presence of either or both of the hours and minutes components. The location of the "m", if present, will always be later in the string than the location of the "h", if present. If either is not present the formula uses a value of zero for that component. The MAX function then provides the farthest position in the original string that precedes the seconds value, and determines how much of the string's length is occupied by previous time components.
The helper columns can be hidden. They could be consolidated into the formula in column E, but if you look at how many times those values are used, the resulting formula would be insanely long and difficult to maintain.