Periodic and almost periodic solutions of differential