String inputA = "20:00:00"; String inputB = "04:00:00"; String[] arrStrA = inputA.split(":"); String[] arrStrB = inputB.split(":");