In this study, we investigate the scenario in which the stochastic signal arises from primordial gravitational waves. Within this framework, we consider two distinct possibilities: one in which the pulsar timing arrays (PTAs) signal corresponds to a stochastic gravitational-wave background (SGWB), and one in which it does not. Primordial gravitational waves can generate an SGWB spanning an exceptionally broad frequency range and are also a source of B-mode polarization in the cosmic microwave background (CMB). We combine CMB B-mode polarization data from BICEP/Keck (BK18), Planck (Planck18), and baryon acoustic oscillation (BAO) measurements with SGWB limits from PTAs to derive updated constraints on the tensor spectral index of the primordial power spectrum. Under the assumption of no detection of an SGWB from PTAs, the allowed parameter space excludes a large portion of the positive region. The constraint within PTA limits is $n_t= -0.165^{+1.20}_{-1.56}$ at $95\%$ confidence level, which are consistent with those obtained from the combined BK18+Planck18+BAO dataset, leading to tighter constraints on the tensor spectral index. Conversely, if the PTA signal is interpreted as an SGWB, the likelihood distribution for the tensor spectral index favors positive values, with $n_t= 2.39^{+1.46}_{-1.35}$ at $95\%$ confidence level, providing evidence for a blue-tilted primordial gravitational-wave power spectrum. In this case, the allowed parameter space excludes the negative region.