Effect of a magnetic field on the long-range magnetic order in insulating Nd2CuO4 and nonsuperconducting and superconducting Nd1.85Ce0.15CuO4