optimize time format in db