Generalized time dependent oscillators. Results from a group theoretical approach and their application to cosmology