Time Conversion

  • + 0 comments

    python using array slicing:

    def timeConversion(s): newS = "" if "AM" in s and "12" in s: newS = "00" elif "PM" in s and "12" not in str(s[:2]): newS = str(int(s[:2]) + 12) else: return s[:len(s)-2] return newS + s[2:len(s)-2]