Converts time to date to compare it