Searches are performed for both promptlike and long-lived dark photons, A′, produced in proton-proton collisions at a center-of-mass energy of 13 TeV, using A′→μ+μ- decays and a data sample corresponding to an integrated luminosity of 1.6 fb-1 collected with the LHCb detector. The promptlike A′ search covers the mass range from near the dimuon threshold up to 70 GeV, while the long-lived A′ search is restricted to the low-mass region 214<m(A′)<350 MeV. No evidence for a signal is found, and 90% confidence level exclusion limits are placed on the γ-A′ kinetic-mixing strength. The constraints placed on promptlike dark photons are the most stringent to date for the mass range 10.6<m(A′)<70 GeV, and are comparable to the best existing limits for m(A′)<0.5 GeV. The search for long-lived dark photons is the first to achieve sensitivity using a displaced-vertex signature.