Stellar populations of early-type galaxies in different environments - II. Ages and metallicities