Simplify the code of string to time conversion
Update