The linear and the third-order nonlinear optical properties of an exciton confined in a three-dimensional quantum dot with a parabolic potential are studied in a static magnetic field. Eigenvalues, wave functions, dipole matrix elements and selection rules are calculated analytically. Based on the calculated energies and wave functions, within the effective mass approximation, a compact-density matrix approach is employed to analyse the absorption coefficients and refractive index changes. The study is first of its kind since the excitonic effects are studied in a static magnetic field considering both the confinement potential and the electrostatic interaction between the electron-hole pair. An important finding of our research is the dependence of the magnitude of absorption coefficients on the radius of the quantum dot, the result that may have broad implications in future device designing.