  Ultralight boson fields, with a mass around $10^{-23}\text{eV}$, are
promising candidates for the elusive cosmological dark matter. These fields
induce a periodic oscillation of the spacetime metric in the nanohertz
frequency band, which is detectable by pulsar timing arrays. In this paper, we
investigate the gravitational effect of ultralight tensor dark matter on the
arrival time of radio pulses from pulsars. We find that the pulsar timing
signal caused by tensor dark matter exhibits a different angular dependence
than that by scalar and vector dark matter, making it possible to distinguish
the ultralight dark matter signal with different spins. Combining the
gravitational effect and the coupling effect of ultralight tensor dark matter
with standard model matter provides a complementary way to constrain the
coupling parameter $\alpha$. We estimate $\alpha \lesssim 10^{-6}\sim 10^{-5}$
in the mass range $m<5\times 10^{-23}\mathrm{eV}$ with current pulsar timing
array.
