ShungFeng, if you have two time values stored as tDateTime, you do not need to convert anyting. Just use GetRamdomTimeBetween(time1,time2) directly, or make your calculations right away.
You are trying to decode your tDateTime variable just to encode it as a tDateTime again!