Convert time to milliseconds