Added logic to convert time