Set time from database