Formation histories of early-type galaxies at z=1.2 in cluster and field environments