Added condition of null time in db and converting it