We investigate the cosmic evolution of the absolute and specific star formation rate (SFR, sSFR) of galaxies as derived from a spatially-resolved study of the stellar populations in a set of 366 nearby galaxies from the CALIFA survey. The analysis combines GALEX and SDSS images with the 4000 break, H_beta, and [MgFe] indices measured from the datacubes, to constrain parametric models for the SFH, which are then used to study the cosmic evolution of the star formation rate density (SFRD), the sSFR, the main sequence of star formation (MSSF), and the stellar mass density (SMD). A delayed-tau model, provides the best results, in good agreement with those obtained from cosmological surveys. Our main results from this model are: a) The time since the onset of the star formation is larger in the inner regions than in the outer ones, while tau is similar or smaller in the inner than in the outer regions. b) The sSFR declines rapidly as the Universe evolves, and faster for early than for late type galaxies, and for the inner than for the outer regions of galaxies. c) SFRD and SMD agree well with results from cosmological surveys. At z< 0.5, most star formation takes place in the outer regions of late spiral galaxies, while at z>2 the inner regions of the progenitors of the current E and S0 are the major contributors to SFRD. d) The inner regions of galaxies are the major contributor to SMD at z> 0.5, growing their mass faster than the outer regions, with a lookback time at 50% SMD of 9 and 6 Gyr for the inner and outer regions. e) The MSSF follows a power-law at high redshift, with the slope evolving with time, but always being sub-linear. f) In agreement with galaxy surveys at different redshifts, the average SFH of CALIFA galaxies indicates that galaxies grow their mass mainly in a mode that is well represented by a delayed-tau model, with the peak at z~2 and an e-folding time of 3.9 Gyr.