Context. The existence of a significant population of Ap stars with very long rotation periods (up to several hundred years) has progressively emerged over the past two decades. However, only lower limits of the periods are known for most of them because their variations have not yet been observed over a sufficient timebase. Aims. We determine the rotation period of the slowly rotating Ap star HD 18078 and we derive constraints on the geometrical structure of its magnetic field. Methods. We combine measurements of the mean magnetic field modulus obtained from 1990 to 1997 with determinations of the mean longitudinal magnetic field spanning the 1999-2007 time interval to derive an unambiguous value of the rotation period. We show that this value is consistent with photometric variations recorded in the Stroemgren uvby photometric system between 1995 and 2004. We fit the variations of the two above-mentioned field moments with a simple model to constrain the magnetic structure. Results. The rotation period of HD 18078 is (1358 +/- 12) d. The geometrical structure of its magnetic field is consistent to first order with a colinear multipole model whose axis is offset from the centre of the star. Conclusions. HD 18078 is only the fifth Ap star with a rotation period longer than 1000 days for which the exact value of that period (as opposed to a lower limit) could be determined. The strong anharmonicity of the variations of its mean longitudinal magnetic field and the shift between their extrema and those of the mean magnetic field modulus are exceptional and indicative of a very unusual magnetic structure.