def convertTimeFormatToSecs(timeString):
    """Converts the time in format h:mm:ss to seconds from midnight.
    The input is a string and must have the format h:mm:ss or hh:mm:ss.
    Example:    
    #print(convertTimeFormatToSecs('14:03:04'));
    """
    # gets the value of hour, minute, and second
    hhStr = timeString[:timeString.find(':')];
    mmStr = timeString[(timeString.find(':')+1):timeString.rfind(':')];
    ssStr = timeString[timeString.rfind(':')+1:];
    
    # converts the string values into int values
    hhInt = int(hhStr);
    mmInt = int(mmStr);
    ssStr = int(ssStr);
    
    # calculates the number of seconds from midnight
    return (hhInt*3600 + mmInt*60 + ssStr);