If you catch the flu, you’re contagious for 1 to 2 days before you start to show symptoms and for up to 5 to 7 days after becoming sick. That means you may be able to pass on the flu to someone before you know you are sick as well as while you are sick.
As for a cold, you are most contagious for the first 2 or 3 days. A cold is usually not contagious after the first week.