  An ultralight scalar field is one of the dark matter candidates. If it
couples with Standard Model particles, it oscillates mirrors in
gravitational-wave detectors and generates detectable signals. We study the
spectra of the signals taking into account the motion of the detectors due to
the Earth's rotation/the detectors' orbital motion around the Sun and formulate
a suitable data-analysis method to detect it. We find that our method can
improve the existing constraints given by fifth-force experiments on one of the
scalar field's coupling constants by a factor of $\sim 30$, $\sim 100$ and
$\sim 350$ for $m_\phi = 2 \times 10^{-17}~\mathrm{eV},~10^{-14}~\mathrm{eV}$
and $10^{-12}~\mathrm{eV}$ respectively, where $m_\phi$ is the scalar field's
mass. Our study demonstrates that experiments with gravitational-wave detectors
play a complementary role to that Equivalence Principle tests do.
