Van der Waals interactions play an important role in layered materials such as MoS2 and MoO3. Within density functional theory, several methods have been developed to explicitly include van der Waals interactions. We compare the performance of several of these functionals in describing the structural and electronic properties of MoS2 and MoO3. We include functionals based on the local density or generalized gradient approximations, but also based on hybrid functionals. The coupling of the semiempirical Grimme D2 method with the hybrid functional HSE06 is shown to lead to a very good description of both structural and electronic properties.