The solar gravitational moments $J_{2n}$ are important astronomical quantities whose precise determination is relevant for solar physics, gravitational theory and high precision astrometry and celestial mechanics. Accordingly, we propose in the present work to calculate new values of $J_{2n}$ (for $n$=1,2,3,4 and 5) using recent two-dimensional rotation rates inferred from the high resolution SDO/HMI helioseismic data spanning the whole solar activity cycle 24. To this aim, a general integral equation relating $J_{2n}$ to the solar internal density and rotation is derived from the structure equations governing the equilibrium of slowly rotating stars. For comparison purpose, the calculations are also performed using rotation rates obtained from a recently improved analysis of SoHO/MDI heliseismic data for solar cycle 23. In agreement with earlier findings, the results confirmed the sensitivity of high order moments ($n>1$) to the radial and latitudinal distribution of rotation in the convective zone. The computed value of the quadrupole moment $J_{2}$ ($n=1$) is in accordance with recent measurements of the precession of Mercurys perihelion deduced from high precision ranging data of the MESSENGER spacecraft. The theoretical estimate of the related solar oblateness $Delta_{odot}$ is consistent with the most accurate space-based determinations, particularly the one from RHESSI/SAS.