This thesis is organized as follows. In Chapter 1 we will illustrate the basic concepts of DFT and TDDFT; the most common computational approaches will be also considered. In Chapter 2 our new formalism will be introduced together with the numerical algorithm and a first application to benzene. In chapter 3 we will illustrate a technique for extrapolating the Lanczos coefficients and to accelerate the convergence of the method. The resulting methodology will be applied to more challenging problems, such as fullerene and chlorophyll spectra. In Chapter 4 the method will be applied to the study of dye-sensitized solar cells. In appendix A and B we will give the technical details of our specific implementation in the plane-wave pseudopotential framework.